Php_self,script_name,request_uri difference, RequestUri
$_server[php_self], $_server[script_name], $_server[' Request_uri ') are very similar in usage, and they return information about the address of the page that is currently being used, Here are some relevant examples to help determine which ones are best suited for your script.
$_server[' Php_self ']
Copy the Code code as follows:
http://www.yoursite.com/example/-–-/example/index.php
http://www.yoursite.com/example/index.php-–-/example/index.php
http://www.yoursite.com/example/index.php?a=test-–-/example/index.php
Http://www.yoursite.com/example/index.php/dir/test-–-/dir/test
When we use $_server[' php_self '], it automatically returns index.php regardless of whether or not the URL address is index.php. But if you add a slash after the file name, you'll return all of the contents back to the $_server[ ' Php_self '].
$_server[' Request_uri ']
Copy the Code code as follows:
http://www.yoursite.com/example/-–-/
http://www.yoursite.com/example/index.php-–-/example/index.php
Http://www.yoursite.com/example/index.php?a=test-–-/example/index.php?a=test
Http://www.yoursite.com/example/index.php/dir/test-–-/example/index.php/dir/test
$_server[' Request_uri ' returns the exact address that we wrote in the URL, and returns "/" If the URL is written only to "/"
$_server[' Script_name ']
Copy the Code code as follows:
http://www.yoursite.com/example/-–-/example/index.php
http://www.yoursite.com/example/index.php-–-/example/index.php
http://www.yoursite.com/example/index.php-–-/example/index.php
http://www.yoursite.com/example/index.php/dir/test-–-/example/index.php
is the current file name in all returns/example/index.php
http://www.bkjia.com/PHPjc/932495.html www.bkjia.com true http://www.bkjia.com/PHPjc/932495.html techarticle Php_self,script_name,request_uri difference, RequestUri $_server[php_self], $_server[script_name], $_SERVER[' REQUEST_ The URI '] is very similar in usage, and all they return is with ...