0
我有以下用于缩短搜索引擎优化网址的代码。用PHP搜索引擎优化的网址缩短
<?php
function getURL($url){
$urlGet = parse_url($url);
$queries = explode("&", $urlGet['query']);
$newURL = $urlGet['path'];
foreach($queries as $query) {
$queryContent = explode("=", $query);
$queryContent[0] == "Ad"? $newURL .= str_replace(" ", "-", $queryContent[1]):$newURL .= "/".$query;
}
return $newURL;
}
?>
当我点击以下即时得到这个错误 未找到
的链接请求的URL/deffsale/AllAds /其他-Mobile的电话/平板电脑并没有在此服务器上找到。
<a href="<?php echo getURL('AllAds/?Ad=Other Mobile Phones/Tablets'); ?>">Other Mobile Phones/Tablets</a><br>
然而,点击缩短的URL之前INTIAL链接,它的运作非常well.Im测试它在我的localhost.Please帮我解决这个问题
<a href="AllAds/?Ad=Other Mobile Phones/Tablets">Other Mobile Phones/Tablets</a><br>
我真的在黑暗中进一步说明 –