是否可以用JS或PHP打印HTML实体? [英] Is it possible to print a HTML entity in JS or PHP?

查看:65
本文介绍了是否可以用JS或PHP打印HTML实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在JavaScript或PHP中打印html实体。

I would like to know if it is possible to print a html entity in JavaScript or PHP.

示例:

console.log(7);

每当我尝试时,它将7 转换为7,而不显示实体编号。

Whenever i try, it converts 7 into 7 instead of showing the entity number.

推荐答案

您必须对&符号进行编码才能起作用。请尝试以下操作并查看其工作原理:

You have to encode the ampersand for that to work. Try the following and see how it works:

console.log('7');

这篇关于是否可以用JS或PHP打印HTML实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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