Php basic tutorial-learning summary, php basic tutorial Summary
I. php and forms
1. Manually send data using the POST method:
Some differences:
GET:
1. Aggregate the information and send it as part of the URL
2. Limited number of transfers
3. Public transmission, such as the exposure of password information
4. The created form can be added as a bookmarks.
POST:
1. The transmitted information is invisible to the user
Usage example:
Html file: ws.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> </Form> </body>
Php file: handle. php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?phpini_set('display_errors', 1);error_reporting(E_ALL|E_STRICT);$title=$_POST['title'];$name =$_POST['name'];</span></strong>print "<p> hello $title $name";?></body> Input: myname
Result: hello Mr myname
2. GET transfers data
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Php file: handle. php
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?phpini_set('display_errors', 1);error_reporting(E_ALL|E_STRICT);$name=$_GET['name'];print "hello $name";?>
</body>
Ii. Related Function Learning
1. format the value:
Round (number to be formatted, retain the number of decimal places );
Eg: $ test = 5.555555555; round (test, 2); // 5.55
Number_format (number, number of decimal places, instead of the decimal point, thousands of separators)
Eg: number_format ("10000000", 2, "."); // 10.000.000, 00
2. Random Functions rand ()
Eg: rand (0,100); // generate a random number ranging from 0 to 100.