$php_self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; if ('/' == substr($php_self, -1)){ $php_self .= 'index.php'; } define('PHP_SELF', $php_self);
如果
echo basename(PHP_SELF)
显示为:index.php
如果
echo basename(PHP_SELF,'.php')
显示为:index