Php basic tutorial-learning summary, php basic tutorial Summary

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.