Example url:http://www.111cn.net/test/test.php
The code is as follows |
Copy Code |
$_server[' server_name ']: www.111cn.net $_server[' Server_port ': 80 $_server[' Request_uri ']:/test/test.php |
Then we can combine the above sentences to make it happen.
The full URL path is:
The code is as follows |
Copy Code |
"http://". $_server[' server_name '].$_server[' Request_uri ' |
If you are opening the port number, we can use $_server[' Server_port ', the above code to modify it.
The code is as follows |
Copy Code |
"http://". $_server[' server_name '. ': '. $_server[' server_port '].$_server[' ' Request_uri '] |
We should pay attention to one point.
$_server[' Php_selft '] differs from the $_server[' Script_name ' and $_server[' Request_uri ' and $_server[' query_string ']:
$_server[' php_self ' returns/PHPTOUR/TEST7.PHP/A=B and returns the file name/following
$_server[' Script_name ' only returns/phptour/ test.php, does not return the content after the file name
http://localhost:60/phptour/test/test7.php/a=b
$_server[' php_self '] will get:/ Phptour/test/test7.php/a=b
$_server[' script_name '] will get:/phptour/test/test7.php
$_server[' REQUEST_URI '] will get :/phptour/test/test7.php/a=b
$_server[' query_string '] will get: '