简体   繁体   English

您如何使用PHP回显以下特殊字符并使浏览器显示这些特殊字符:

[英]how do you echo the following special characters using PHP and make the browser display these:

Help I am stuck with the following Problem and i cant figure this out. 帮助我遇到以下问题,无法解决。 I am supposed to do the following in PHP: 我应该在PHP中执行以下操作:

Set a variable to the following: “<&¢£¥€©>” and output it as shown to the browser window. 将变量设置为以下内容:“ <&¢£¥€©>”,然后将其输出到浏览器窗口。

Here is my code: <?php $str = "&lt;&amp;&cent;&pound;&yen;&euro;&copy;&gt;" 这是我的代码: <?php $str = "&lt;&amp;&cent;&pound;&yen;&euro;&copy;&gt;" echo htmlspecialchars($str); ?>

but i keep getting an error. 但我一直出错。

Missing semicolon 缺少分号

$str = "&lt;&amp;&cent;&pound;&yen;&euro;&copy;&gt;"; // <-- missing semicolon
echo htmlspecialchars($str);

Do you mean you want to do something like this? 您是说要这样做吗?

$str = "<&¢£¥€©>";
echo htmlspecialchars($str);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM