我们有本地PHP文件A-Z。重定向开关语句在哪里编码。其实我想用id请求并获得重定向url的真实地址。例如,domain1.com完整路径,domain2.com完整路径。如何在php switch语句中得到url的真实地址
请有人让我知道,如何获得这些网址的真正的域路径?
<?php
$id = $_GET['id'];
switch ($id) {
case 01:
header("Location: http://domain1.com");
break;
case 02:
header("Location: http://domain2.com");
break;
default:
header("Location: http://");
break;
}
?>
我该如何请求ID?
http://localhost/a.php?id=123
和URL的这样其返回实地址:
http://www.domain.com/content/title.html // etc
'$ _ SERVER [ 'HTTP_HOST']。 $ _SERVER ['REQUEST_URI']',http://www.php.net/manual/en/reserved.variables.server.php – NHG
你知道'01'和'02'是八进制数吗?现在它不是问题,但是一旦你代码为'08'和'09' –
yes,在第二个php文件中,我请求数字,并且我想要获得真正的URL路径,那么你可能会得到意想不到的结果,那么我有代码插入MySQL数据库中的真实网址。 –