$page = parse_url($_SERVER['PHP_SELF']); echo $page['path'];
Always gives index.php on all pages. And I need one of the specific urls to display my css.
$page = parse_url($_SERVER['PHP_SELF']); echo $page['path'];
Always gives index.php on all pages. And I need one of the specific urls to display my css.
The element $ _SERVER ['PHP_SELF']
The element $ _SERVER ['PHP_SELF'] contains the name of the script, starting from the root directory of the virtual host, i.e. if the query string is an address
http://www.mysite.ru/test/index.php?id=1&test=wet&id_theme=512
then the element $ _SERVER ['PHP_SELF'] will contain the fragment "/test/index.php". As a rule, the same fragment is placed in the $ _SERVER ['SCRIPT_NAME'] element.
Full address to the script
<?php echo "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>
Source: https://ru.stackoverflow.com/questions/172307/
All Articles