In php, how does one determine whether a webpage request is an ajax request or a common request? You can achieve this by passing parameters, for example, using the following URL request/path/to/pkphp.com/script.php? Ajax
Use the following method in
Pathtopkphp. comscript. php? Ajax is judged by using the following method in the php script: the code is as follows: if (isset ($ _ GET [ajax]) {... this is an ajax request, and then ...} /path/to/pkphp.com/script.php? Ajax
Use the following method
Php server variable $ _ SERVER introduction. SERVER variable $ _ SERVER Summary: $ _ SESSION [PHP_SELF] -- get the file name of the currently executing script. $ _ SERVER [SERVER_PROTOCOL] -- Name of the communication protocol and SERVER variable on
Some server information is often used in php programming. I paste the commonly used information in highlighted mode, and the rest will be placed behind it for future reference.
The code is as follows:
$ _ SERVER ['http _ ACCEPT_LANGUAGE '] //
Php variable usage method variable: $ _ SERVER, used in PHP 4.1.0 and later versions. For earlier versions, use $ HTTP_SERVER_VARS
Variable: $ _ ENV, used in PHP 4.1.0 and later versions. For earlier versions, use $ HTTP_ENV_VARS
Variable: $ _
This article introduces the usage of various parameters of $ _ SERVER environment variables. For more information, see this article. $ _ SERVER [#39; PHP_SELF #39;]: relative to the path of the website root directory and PH... this article
$ _ SERVER and php_server in PHP. $ _ SERVER usage instructions in PHP. some SERVER information is often used in PHP programming. the detailed parameters of $ _ SERVER are sorted out for future use. $ _ PHP $ _ SERVER and php_server
Some SERVER
In PHP, the $ _ SERVER variable sorts out the current url :. $ _ SERVER [HTTP_HOST]. $ _ SERVER [PHP_SELF]; $ _ SERVER variable summary $ _ SERVER [QUERY_STRING] query string. $ _ SERVER [DOCUMENT_ROOT] $ _ SERVER variable sorting in PHP currently
For details about $ _ SERVER parameters and descriptions in PHP, read the detailed parameters and descriptions of $ _ SERVER in PHP. some SERVER information is often used in php programming, special to the $ _ SERVER detailed parameters, convenient
$ _ SERVER [& amp; #39; PHP_SELF & amp; #39;] # file name of the script being executed, which is related to documentroot. $ _ SERVER [& amp; #39; argv & amp; #39;] # parameters passed to the script. $ _ SERVER [& amp; #39; argc & amp; #39;] #
1. $ _ SERVER ['php _ SELF '] -- get the file name of the script being executed
2. $ _ SERVER ['server _ Protocol'] -- name and version of the communication PROTOCOL when requesting the page.
3. $ _ SERVER ['request _ time'] -- the timestamp at the
$ _ Server ['php _ Self '] # File Name of the script being executed, which is related to document root.$ _ Server ['argv'] # parameters passed to the script.$ _ Server ['argc '] # contains the number of command line parameters passed to the Program (
Server variable $ _ server details:
1. $ _ session ['php _ Self '] -- get the file name of the script being executed
2. $ _ server ['server _ Protocol'] -- name and version of the communication protocol when requesting the page. For example, "HTTP/1.
In PHP, we generally use $ _ server ['HTTP _ host'] to obtain the domain name or IP address of the website in the URL.The explanation in the PHP manual is as follows:
"Http_host": the host of the current request: the content of the header
Variable: $ _ server, used in PHP 4.1.0 and later versions. For earlier versions, use $ http_server_vars
Variable: $ _ ENV, used in PHP 4.1.0 and later versions. For earlier versions, use $ http_env_vars
Variable: $ _ cookie, used in PHP 4.1.0 and
CopyCode The Code is as follows: $ _ server ['HTTP _ accept_language '] // browser Language
$ _ Server ['remote _ ADDR '] // ip address of the current user.
$ _ Server ['remote _ host'] // host name of the current user
$ _ Server ['request _ URI '] /
Http://hi.baidu.com/sungoogle/blog/item/015d19305180869ba8018e68.html
Today, I carefully studied the manual about server variables and wrote a note to help beginners.
I think the red part is more common and important. The blue part is added after
In-depth analysis of the SERVER variable $ _ SERVER:
1. $ _ SESSION ['php _ SELF '] -- get the file name of the script being executed
2. $ _ SERVER ['server _ Protocol'] -- name and version of the communication PROTOCOL when requesting the page. For
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.