我有一個用於將http://
添加到URL,它不具有http://
類似如下添加HTTP到URL
function addhttp($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "http://" . $url;
}
return $url;
}
我的問題是一個功能,
如果我通過網址與&
,在&
後的字符串將跳過, 如:
https://www.example.com/Welcome/Default.aspx?scenarioID=360&pid=3308&treeid=1000 返回
https://www.example.com/Welcome/Default.aspx?scenarioID=360
我輸了&pid=3308&treeid=1000
這部分,如何解決這個錯誤?
我返回正確的,但如何和你在哪裏傳遞的網址是什麼? –
這實際上是一個codeigniter函數,它會像$ url = $ this-> addhttp($ _ GET ['u']); – Shin
嗯好吧,但我真的不會失去任何東西,當我運行你的代碼。 http://sandbox.onlinephpfunctions.com/code/67eb0e9fe39041db0ebb51ea975daa7fa424f818 –