Use the PHP variable php_self to redirect pages. We may jump to pages that are similar to html bookmarks, but php programs provide different Web content in the same program by modifying the URL parameters. Try to compare
The page jump here is similar to the jump of html bookmarks, but the php program provides different Web content in the same program by modifying the URL's tail parameters. Try to compare the following two URLs:
Http://www.gxblk.com/pc/index.php
Http://www.gxblk.com/pc/index.php? Page = 2
The difference between the two URLs is that the second URL has one more parameter (? Page = 2), when we open them, the content in the browser is different, and when we click them, they jump in the same page. This is implemented using the PHP variable php_self. The php program compiled by the user will be based on the index. different php tail parameters generate different content, but all use the same web page program (index. php), so we call it "page jump". In fact, it generates another Web document.
We know from the second URL above that the built-in variable $ php_self uses the question mark bootstrap parameter. the specific format is as follows:
$ Php_self? Variable name = value (instance: $ php_sefl? Id = 0)
Variable names after question marks are custom. Generally, they are named as English names with higher readability (which can be abbreviations ). For example, if we let the link point to a functional block of the program to complete a delete operation, we can name it $ del, which is embodied in the code $ php_self? Del = value. if you click this link, the program will perform the delete operation (of course, the delete operation code must be written separately ):
Link code:
- Print
- "<A href =" $ php_self? Del = true ">
- Delete selected content
- </A> ";
Jump Code:
- If ($ del = "true ")
- {
- // Here is the deletion code
- }
The PHP variable php_self can contain multiple parameters. The first parameter usage question (?) Bootstrap. the following parameters are guided with the "and" (&). the format and example 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_self's tail parameters should be written together, but variables connected to the number can be separated by spaces or other valid symbols (such as the + sign)-sometimes we do need to separate them, for example, if you want to pass the arv verification, the symbol & will have some impact. the html code generated after the separation is recognized by arv.
The PHP variable php_self is a very useful built-in variable of php. it is usually used for paging and pre-defined operations. The variable in the tail parameter included in it is read using $ in php, as shown in the following address:
Http://www.gxblk.com/pc/index.php? Page = 3
We will read the page number from the above address and display the page content:
$ Conts = echo_conts ($ page );
Echo_conts is a self-compiled function that is used to display the content of each page. The value of the variable $ page is the key and determines the content range extracted by the program from the library file.
In other, the page jumps to different pages, such as html Bookmarks. Instead, the php program provides different Web content in the same program by modifying the URL's tail parameters. Try to compare...