Php obtains the complete URL code of the current page. 2. php code: # test URL: localhostblogtesturl. php? HTTP_HOST]. br; # obtain the webpage address echo $ _ SERVER [P
2. php code:
# Test URL: http: // localhost/blog/testurl. php? Id = 5 //
For more information about the smarty template path, see the css and image link paths on my template page when using smarty. Baidu says that the introduced path is relative to the PHP file, but I introduced it, right?
Please help
Reply to
Malicious refresh means to constantly refresh the submitted page, resulting in a large amount of invalid data. The following is a summary of php's methods to prevent malicious page refreshing:
A verification string must be passed between pages,A
Many functions can be used to obtain url addresses in php. The global variable server provides me with many methods. Let's take a look.
Common functions
The Code is as follows:
Copy code
// Obtain the domain name or host
Echo "php obtains the current url ";$ Url = "http: //". $ _ SERVER ['HTTP _ host']. $ _ SERVER ['php _ SELF '];Echo $ url;?>
the following code is: php obtains the root directory of the website.
$ PHP_SELF = $ _ SERVER ['php _ SELF '];$ Url =
Some SERVER information is often used in PHP programming. The detailed parameters of $ _ SERVER are sorted out for future use. $ _ SERVER [PHP_SELF] # File Name of the script being executed, which is related to documentroot. $ _ SERVER [argv] #
First, PHP retrieves the URL of the current page:Copy codeThe Code is as follows:// Obtain the current Script URLFunction GetCurUrl (){If (! Empty ($ _ SERVER ["REQUEST_URI"]){$ ScriptName = $ _ SERVER ["REQUEST_URI"];$ Nowurl = $ scriptName;}Else{$
The following describes how to use the header function. No matter how many headers are on the page, the function executes the last one, but it is conditional. For example: header (Location: www.jb51.net); header (Location: www.g.cn); header
If you have just started learning PHP, there may be many functions that need to be studied. Today we will learn how to use PHP Header (). For more instructions, please refer to the PHP Chinese manual. The following describes how to use the header
Provides various official and user-released code examples. For code reference, you are welcome to discuss ThinkPHP bug in CGI Mode.
Php experience sharing group: 323899029
In general, $ _ SERVER ['php _ SELF '] is no different from $ _ SERVER
Php gets the value of $ _ SERVER [REQUEST_URI. Among the many predefined SERVER variables in PHP, $ _ SERVER [REQUEST_URI] is frequently used, but this variable is only supported by apache. therefore, among the many predefined SERVER variables in
PHP anti-CC attack implementation code summary. A cc attack means that the other party uses programs or some agents to continuously access your website. as a result, your website cannot be processed and is in the status of an on-premise server, next,
: This article describes how to obtain php paths. For more information about PHP tutorials, see. Php retrieves the url path of the current page
# Test URL: http: // localhost/blog/testurl. php? Id = 5 // Obtain the domain name or HOST address echo $
Usage of the PHPheader () function (incorrect settings such as 301 and 404)
Header ("HTTP/1.1 404 Not Found ");
For the ErrorDocument 404/404. php function in apache configuration
Error_page 404/404
System variables and environment variables in php
This article describes how to learn about system variables and environment variables in php.In daily php programming, system variables and environment variables are sometimes modified to
A handy php paging class
/**
Paging query class
@ Link http://bbs.it-home.org
*/
Class paging
{
Private $ pageSize; // the default number of items displayed on no page is 10.
Malicious refresh means to constantly refresh the submitted page, resulting in a large amount of invalid data. The following is a summary of php's methods to prevent malicious page refreshing:
A verification string must be passed between pages,
A
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.