以下代码段在 localhost:3000 上运行时效果很好但在 localhost / dir / 上运行时停止工作,并且每个事物都显示默认的大小写结果即使是 /
<?php
// Grabs the URI and breaks it apart in case we have querystring stuff
$request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
// Route it up!
switch ($request_uri[0]) {
// Home page
case '/':
echo "/ here\n";
break;
// About page
case '/about':
echo "about.php is opened from here\n";
break;
// Everything else
default:
header('HTTP/1.0 404 Not Found');
echo "404 is opened from here \n";
break;
}
?>