garry27 Posted January 21, 2007 Share Posted January 21, 2007 i've tried to use the php self a number of times but i can never get it to work. here, i'm trying to say if the current executable is called index.php then ...[code]$_SERVER['PHP_SELF'] !== 'index.php'[/code]the function that's calling it is in a folder called php_functions in the root directory and index.php is in the root Link to comment https://forums.phpfreaks.com/topic/35112-server-variable-and-php_self/ Share on other sites More sharing options...
jozard Posted January 21, 2007 Share Posted January 21, 2007 $_SERVER['php_self'] returns the full URL path, like http://267.21.212.22/.../index.php, and not just the file name.try to use preg_match to determine if the filename is contained in $_SERVER['php_self']. Link to comment https://forums.phpfreaks.com/topic/35112-server-variable-and-php_self/#findComment-165733 Share on other sites More sharing options...
kevinkorb Posted January 21, 2007 Share Posted January 21, 2007 Actually $_SERVER['PHP_SELF'] would return just the filename with no querystring...i.e.http://www.yourdomain.com/index.phpIt will return '/index.php';this will help you with your server variables.[code=php:0]<?phpecho "<pre>";print_r($_SERVER);echo "</pre>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/35112-server-variable-and-php_self/#findComment-165742 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.