I am developing facebook/myspace content share buttons. The Facebook link takes you to a URL on my website, but I need to pass additional parameters to my URL along with the parameters passed to facebook. Here's my example:
http://www.facebook.com/share.php?t=MyCompany&u=http://foobar.com/test7.php?Share=161&FbShare=Facebook28
Do I need to escape something inside the "u" parameter?
你应该可以做(http://php.net/manual/en/function.urlencode.php)。
$url = 'http://www.facebook.com/share.php?t=MyCompany&u='.urlencode('http://foobar.com/test7.php?Share=161&FbShare=Facebook28');
You need to use urlencode
on the u
parameter, which will result in your URL looking like this:
http://www.facebook.com/share.php?t=MyCompany&u=http%3A%2F%2Ffoobar.com%2Ftest7.php%3FShare%3D161%26FbShare%3DFacebook28
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.