The usage analysis of PHP function php_self

Source: Internet
Author: User
    1. $php _self? variable name = value (instance: $php _sefl?id=0)
Copy Code

The variable name that follows the question mark is custom, and is typically named in the English name (which can be abbreviated) that is more readable, as needed. For example, we have the link to a function block of the program is to complete a delete operation, then we can be named $del, reflected in the code is the $php_self?del= value, if clicked on the link, the program performs the delete operation (of course, delete operation code to be written separately): Link code:

    1. Print "Delete Selection";
Copy Code

Jump code:

    1. if ($del = = "true") {
    2. Here is the delete code
    3. }
Copy Code

$php _self can take multiple parameters, the first parameter uses the problem (?) boot, and the following parameters are guided with the "and" (&) format and examples are as follows:

Syntax: $php _self? variable 1= value & variable 2= value & variable 3= value

Example: $php _self?user=blackhorse&id=write&page=0 in principle, $php the trailing parameters of the _self should be concatenated, but the variables connected with the number can be separated by spaces or other valid symbols (such as the + number)-- Sometimes we do need to separate them, for example, to pass the ARV verification, the symbol & will have some influence, the HTML code generated after separating is recognized by ARV.

$php _self is a very useful built-in variable for PHP, often used for paging, performing predefined operations, and so on. Each variable in the trailing parameter that it takes is read in PHP using $, such as the following address: http://bbs.it-home.org/pc/index.php?page=3

This reads the page numbers from the above address and displays the contents of the pages: $conts =echo_conts ($page); Echo_conts is a self-coding function that displays the contents of each page, and the value of the variable $page is the key, which determines the range of content that the program extracts from the library file.

  • 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.