如何制作将某些HTML文本转换为实体的PHP脚本?

时间:2018-01-24 07:34:08

标签: php html html-entities

我是PHP的初学者 我想创建一个PHP脚本,将标记属性中的某些值替换为HTML实体。

像这样:

<body>
<img src="&#x68;&#x74;&#x74;&#x70;&#x73;&#x3A;&#x2F;&#x2F;&#x70;&#x6C;&#x61;&#x63;&#x65;&#x69;&#x6D;&#x67;&#x2E;&#x63;&#x6F;&#x6D;&#x2F;&#x36;&#x34;&#x30;&#x2F;&#x34;&#x38;&#x30;&#x2F;&#x6E;&#x61;&#x74;&#x75;&#x72;&#x65;" alt="&#x47;&#x6F;&#x6F;&#x67;&#x6C;&#x65;&#x20;&#x57;&#x65;&#x62;&#x73;&#x69;&#x74;&#x65;" height="&#x34;&#x32;" width="&#x34;&#x32;">
</body>

1 个答案:

答案 0 :(得分:0)

使用现有功能:htmlentities()

手动链接:http://php.net/htmlentities