php - 如何在php中回显ascii加密文本

标签 php javascript character-encoding escaping ascii

我正在尝试像这样回显 ascii 加密文本:

$x = encrypt("hello there");
 echo $x;

加密函数返回

&#104&#101&#108&#108&#111&#32&#116&#104&#101&#114&#101

但在屏幕上它打印为“你好”。

如何打印原始 ascii 值?

最佳答案

您可以在加密周围使用 htmlentities() 来转义 &。

$x = htmlentities(encrypt("hello there"));
 echo $x;

关于php - 如何在php中回显ascii加密文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8307406/

相关文章:

mysql - 在 R 中从 MySQL 获取 UTF-8 文本返回 "????"

HTML 表单、字符集和 accept-charset 属性

php - 如何将发布数据放入 CodeIgniter 中的数组中?帖子项目是数组

javascript - 如何在移动浏览器中禁用内容选择

javascript - 尝试使用 d3.csv 时出现错误 "data not defined"?

javascript - IE 和 javascript : efficient way to decode (and render) b64-encoded PDF blob

javascript - 在表中提交按钮后在 HTML 中保留 input=date 值

php - 为什么 PHP 函数 htmlentities(...) 返回错误结果?

php - MySQL 查询使用 $_GET

javascript - Kentico reCaptcha 不会阻止表单提交