Home > Backend Development > PHP Tutorial > Usage analysis of php function PHP_SELF

Usage analysis of php function PHP_SELF

WBOY
Release: 2016-07-25 08:58:15
Original
1723 people have browsed it
  1. $php_self?Variable name=value (Example: $php_sefl?id=0)
Copy code

The variable name after the question mark is customized. Usually, it is named to be more readable as needed English name (can be abbreviated). For example, if we let the link point to a certain function block of the program to complete a deletion operation, then we can name it $del, which is reflected in the code as $php_self?del= value. If the link is clicked, the program will execute Delete operation (of course, the deletion operation code must be written separately): Link code:

  1. print "Delete selected content";
Copy code

Jump code:

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

$php_self can take multiple parameters, the first parameter usage problem (? ) to guide, the following parameters are guided using the ampersand (&), the format and examples are as follows:

Syntax: $php_self?Variable1=value&variable2=value&variable3=value

Example: $php_self?user=blackhorse&id=write&page=0 In principle, the tail parameters of $php_self should be written together, but the variables connected with the ampersand can be separated by spaces or other valid symbols (such as + signs) - sometimes we do need to separate them, for example, if we want to pass arv For verification, the symbol & will have some impact, and the html code generated after separation will be recognized by arv.

$php_self is a very useful built-in variable in PHP, which is usually used for paging, performing predefined operations, etc. The variables in the tail parameters it carries can be read using $ in PHP, such as the following address: http://bbs.it-home.org/pc/index.php?page=3

This will read the page number from the above address and display the content of the page: $conts=echo_conts($page); echo_conts is a self-written function that is used to display the content of each page, and the value of the variable $page is the key. It determines the content range that the program extracts from the library file.



source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template