可以通过判断$s是否等于'index'或'index.php'来跳过这段代码的执行。修改后的代码如下:

// 如果是非正常URL,则显示404并退出
if ($s === '' && $s !== 'index' && $s !== 'index.php') {
    rt_log_error('bad guy short_url: '.$short_url);
    echo '404'; echo "<br>"; echo "<a href='index.php' >点这里返回首页</a>";
    exit;
}

这样,当$s为空且不是'index'或'index.php'时,才会执行显示404并退出的逻辑。

如果是非正常URL则显示404并退出if $s === rt_log_errorbad guy short_url $short_url; echo 404; echo br; echo a href=indexphp 点这里返回首页a; exit;修改上面这段代码使其不对首页和indexphp起作用

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

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