2016-08-22 60 views

回答

0

如果我理解正確,這個URL與動態查詢字符串的到來。而你想刪除查詢字符串部分並重定向到這個修改後的URL。

我們假設動態URL存儲在變量$ url中。

試試這個:

$url = "https://[email protected]"; 
$modified_url = strstr($url, "?", true); // Remove the query string, which results in https://test.com 

header("location:".$modified_url); // Redirect to the modified URL. 
0

可以存儲在一個變量的動態部分,並使用header()功能來重定向用戶。

$dynamicPart = "[email protected]"; 
header("Location: https://test.com/index.php?username=".$dynamicPart); 
exit;