Analysis of PHP external variables

Source: Internet
Author: User

For beginners of PHP, the understanding of variables is still vague. I hope you can use this article to have a detailed understanding of the PHP external variables and deepen your understanding of the PHP language.

PHP external variable sample code:

  1. <Form action = "one. php"
  2. Method = "get">
  3. User: <input type = "text"
  4. Name = "username"> <br>
  5. Password <input type = "password"
  6. Name = "pass"> <br>
  7. <Input type = "submit" values "OK">
  8. </Form>

 
 
  1. < ?php  
  2. Echo “user”;  
  3. Echo $_get[“username”];  
  4. ?> 

$ _ Get can only accept data sent back by the get Method

$ _ Post can only accept data sent back by the post Method

$ _ Request can accept data sent from all methods

It can also be passed directly. PHP external variables are separated.

<A href = "one. php? Name = hello & pass = hello "> hello </a>.

It is best to use $ _ get or $ _ request to receive the request.

Other PHP external variables

$ _ Files

$ _ Cookie

$ _ Session

The passed PHP external variables can be used directly on this page.
 


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.