本文介绍了PHP urlencode编码错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我尝试对网址进行编码
If I try to encode the url
http://herthabsc.de/index.php?id=3631&tx_ttnews[tt_news]=13144&cHash=9ef2e9ee006fb16188ebf764232a0ba9
使用urlencode()
或http_build_query()
可以给我结果
http%3A%2F%2Fherthabsc.de%2Findex.php%3Fid%3D3631%26%23038%3Btx_ttnews%5Btt_news%5D%3D13144%26%23038%3BcHash%3D9ef2e9ee006fb16188ebf764232a0ba9
但这不是应该的.是否存在已知的错误?还是在使用wordpress时遇到问题?
But that's not what it should be. Is there a known bug? Or problems in use with wordpress?
推荐答案
您已对该URL进行了双重编码.在输出字符串上运行urldecode()
会给我以下内容:http://herthabsc.de/index.php?id=3631&tx_ttnews[tt_news]=13144&cHash=9ef2e9ee006fb16188ebf764232a0ba9
You've double encoded the URL. Running urldecode()
on your output string is giving me the following: http://herthabsc.de/index.php?id=3631&tx_ttnews[tt_news]=13144&cHash=9ef2e9ee006fb16188ebf764232a0ba9
尝试以下
urlencode(html_entity_decode('http://herthabsc.de/index.php?id=3631&tx_ttnews[tt_news]=13144&cHash=9ef2e9ee006fb16188ebf764232a0ba9'));
这篇关于PHP urlencode编码错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!