我有以下代码
function redireectIfNeeded(){
$url = $_SERVER["REQUEST_URI"];
if(preg_match("/\.php/$", $url))
header("Location: ".preg_replace("/\.php/",$url));
}
这给了我以下错误。
[24-Jul-2012 19:14:18] PHP Warning: preg_match() [<a href='function.preg-match'>function.preg-match</a>]: Unknown modifier '$' in ../dbc.php on line 223
我知道我在某个地方需要一个分隔符,但我尝试过的任何方法都不起作用。谁能让我知道我需要做什么?