I have a function which is used to add an http://
to a url,which do not have a http://
like as below
function addhttp($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "http://" . $url;
}
return $url;
}
My problem is ,
If i pass a url with &
,the string after the &
will skipped,
eg:
https://www.example.com/Welcome/Default.aspx?scenarioID=360&pid=3308&treeid=1000
Returns
https://www.example.com/Welcome/Default.aspx?scenarioID=360
I lose &pid=3308&treeid=1000
this part,How to fix this error??