2012-12-20 43 views
2

我有一個從rss鏈接的頁面。它們分別是: 斷開鏈接未知字符在URL中的%252B

http://news.asiaone.com/News/Latest%252BNews/Singapore/Story/A1Story20121220-390687.html 

工作環節

http://news.asiaone.com/News/Latest%2BNews/Singapore/Story/A1Story20121220-390687.html 

我意識到它通過更改%252B至%2B。即時通訊使用PHP。有沒有辦法在運行中檢測並糾正它?

+0

只需使用'str_replace('%252B','%25%2B','URLHERE')' – PhearOfRayne

回答

0

使用 「urldecode」

echo urldecode("http://news.asiaone.com/News/Latest%252BNews/Singapore/Story/A1Story20121220-390687.html"); 
12

的URL已編碼的兩倍。 %25是「%」的轉義序列,因此常規%2B再次跳轉到%252B

urldecode該值,但最好避免雙重編碼,如果可能的話開始。