图片src包含“&”符号无法作为url param访问此

时间:2015-12-18 07:51:01

标签: facebook image urlencode

我有一张图片src:

https://scontent.xx.fbcdn.net/hphotos-xtl1/v/t1.0-9/s720x720/10291693_1478919849038582_6717876706471049180_n.jpg?oh=0e2416fd3373c0757b7f3dd40169dfa9&oe=57127C81

它包含符号'&'我需要使用没有'&'的网址符号。

我尝试了 urlencode ,但它返回:

HTTPS%3A%2F%2Fscontent.xx.fbcdn.net%2Fhphotos-XTL1%2FV%2Ft1.0-9%2Fs720x720%2F10291693_1478919849038582_6717876706471049180_n.jpg%3Foh%3D0e2416fd3373c0757b7f3dd40169dfa9%26oe%3D57127C81

不起作用。

我也试图取代'&' '%26'

https://scontent.xx.fbcdn.net/hphotos-xtl1/v/t1.0-9/s720x720/10291693_1478919849038582_6717876706471049180_n.jpg?oh=0e2416fd3373c0757b7f3dd40169dfa9%26oe=57127C81

但没有成功。有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

只需删除“&”之后的所有内容,例如:

$variable = substr($variable, 0, strpos($variable, '&'));

来源:Remove portion of a string after a certain character