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>
我真的在黑暗中進一步說明 –