pregmatch "debug" from /new/debug.php


pregmatch "debug" from /new/debug.php

我的preg_match真的很糟糕,找不到正确的公式来获取php页面。

我尝试检查标题,现在打开了哪个页面$_SERVER['REQUEST_URI']

可能的变体是索引、调试、登录、寄存器等。

我想切换一下preg_match检查的内容,然后将切换到打开页面的字段,其中将执行打开链接的脚本。

你可以

这样做,不用preg_match:

$url = parse_url($_SERVER['REQUEST_URI']);
$page = basename($url["path"],".php");
switch($page) {
    case "debug":
        // do something
        break;
    // and so on
}