php02~ pre-defined variables

Source: Internet
Author: User
Pre-defined variables

1. Scope issues

In PHP, there are two scopes for custom variables: global scope (outside function), local scope (inside function)

But:

The predefined scopes become "hyper global Scopes": The sum of global scopes + local scopes.

2: Data type problem:

In general, hyper-global scopes are arrays!

Review:

3. Predefined scopes typically include:

$_get,$_post,$_server,$_request, $GLOBALS .....

(ii) Illustrative examples

$_get variable

Get, which generally appears in the form form: <form action = "abc.php" >.....<form/>

Called: Form submits data in Get mode

$_get, this predefined array variable refers to the collection (array) of all data submitted in this manner.

Of course, you can also submit data by post.

2. In Web pages, get is submitted in a variety of ways

Form 1:

Form 2:

Form 3:

Form 4:

Where the data obtained is the same regardless of the way it was submitted:

<?php

$v 1 = $_get[' uName ')//single quotes, double quotes are OK, essentially a string.

$v 2 = $_get[' upswd ');

?>

Add:

php02~ pre-defined variables

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.