问题描述
我使用php来查看其中包含网址的XML文件。这些网址看起来像这样:
当我回显网址时,& curren显示为¤(也就是#164,A4或货币符号),链接不起作用。即使没有关闭分号,也会发生这种情况。从字面上制作& curren显示最干净的方法是什么?
使用php函数urlencode:
urlencode(https://site.com/bacon_report?Id=1&report=1¤tDimension=2¶m=1
$ p $
会输出%3FId%3D1%26report%3D1%26currentDimension%3D2%26param%3D1
I'm using php to look at an XML file that has a URL in it. The URLs look something like this:
https://site.com/bacon_report?Id=1&report=1¤tDimension=2¶m=1
When I echo out the URLs, the "¤" shows up as "¤" (AKA #164, A4 or currency symbol) and the links don't work. This happens even though there isn't a closing semicolon for it. What is the cleanest way to make "¤" display literally?
Use the php function urlencode:
urlencode("https://site.com/bacon_report?Id=1&report=1¤tDimension=2¶m=1"
will output
https%3A%2F%2Fsite.com%2Fbacon_report%3FId%3D1%26report%3D1%26currentDimension%3D2%26param%3D1
这篇关于如何让& curren字面显示,而不是HTML实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!