更换所有有这样的事情,它更易于阅读和更新位置的项目:
if(!empty($state = $_GET["state"])){
// Location data add multiple lines
$locations["/placercounty"] = array(
"ranges" => array(
array("from" => 90001, "to" => 96162)
)
"matches" => array(
"california",
"placer-county",
"auburn",
)
);
$locations["/northcentralohio"] = array(
"ranges" => array(
array("from" => 44312, "to" => 44312)
)
"matches" => array(
"akron",
)
);
// No need to touch below this
$state = clean($state);
$theZip = strtolower($state);
$location = false;
foreach($locations as $url => $matchData){
if(isset($matchData["matches"])){
if(in_array($theZip, $matchData["matches"])){
$location = $url;
break;
}
}
if(isset($matchData["ranges"])){
foreach($matchData["ranges"] as $rangeData){
if(isset($rangeData["from"]) && isset($rangeData["to"])){
if($theZip >= $rangeData["from"] && $theZip <= $rangeData["to"]){
$location = $url;
break 2;
}
}
}
}
}
if($location){
header("Location: " . $location);
die();
}
}
是不是你的错..但程序员编码这些文件的方式是“真的真的好” .. :| –
而不是复制整个页面尝试仅包括产生问题的代码行。 –
'index.php'代码中有行重定向到'/ searchresult/...',所以我猜这可能是'search.php'?我想,你必须找出答案。但是在'search.php'中没有任何东西可以执行任何重定向。所以看起来你只需要进行更多的调试。 – David