如何让 &curren 按字面意思显示,而不是作为 HTML 实体显示 [英] How to get &curren to display literally, not as an HTML entity

查看:38
本文介绍了如何让 &curren 按字面意思显示,而不是作为 HTML 实体显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 php 查看包含 URL 的 XML 文件.网址如下所示:

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&currentDimension=2&param=1

当我回显 URL 时,&curren"显示为¤"(AKA #164、A4 或货币符号)并且链接不起作用.即使没有结束分号,也会发生这种情况.使&curren"字面上显示的最简洁方法是什么?

When I echo out the URLs, the "&curren" 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 "&curren" display literally?

推荐答案

使用php函数urlencode:

Use the php function urlencode:

urlencode("https://site.com/bacon_report?Id=1&report=1&currentDimension=2&param=1"

会输出

https%3A%2F%2Fsite.com%2Fbacon_report%3FId%3D1%26report%3D1%26currentDimension%3D2%26param%3D1 

这篇关于如何让 &curren 按字面意思显示,而不是作为 HTML 实体显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆