2
我想知道是否有可能重寫一個專爲重寫而設計的URL,如下所示:htaccessPHP替換URL中的變量
我的網址:http://example.com/page.php?page=5&action=something
但我想改變的URL:example.co米/頁/ 5 /東西
這只是在href,htaccess的位就解決了。
我想知道是否有可能重寫一個專爲重寫而設計的URL,如下所示:htaccessPHP替換URL中的變量
我的網址:http://example.com/page.php?page=5&action=something
但我想改變的URL:example.co米/頁/ 5 /東西
這只是在href,htaccess的位就解決了。
function rewritelink($link){
$link = str_replace('.php','', $link);
$pattern = "/\?[^=]*=/";
$replacement = '/';
$link = preg_replace($pattern, $replacement, $link);
$pattern = "/\&[^=]*=/";
$replacement = '/';
$link = preg_replace($pattern, $replacement, $link);
return $link;
}
什麼阻止你做手動? – 2010-09-06 09:49:45
什麼都沒有,只是想知道是否有通過PHP來實現的方法:) – ITg 2010-09-06 09:50:15
我只是需要用'/'來替換?page =基本上,但即使頁面與動作不一樣 – ITg 2010-09-06 09:51:10