// 如果是非正常URL,则显示404并退出\n if ($s === '' && ($_SERVER['PHP_SELF'] !== '/index.php' && $_SERVER['PHP_SELF'] !== '/')) {\n rt_log_error('bad guy short_url: '.$short_url);\n echo '404'; echo "\n"; echo "<a href='index.php' >点这里返回首页</a>";\n exit;\n }\n \n 这样修改后,只有当$s为空且当前页面不是首页或者不是index.php文件时,才会执行404错误和退出的操作。

PHP 404错误处理:排除首页和index.php文件

原文地址: https://www.cveoy.top/t/topic/pCI4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录