php - 如何在 mysql 中存储 html_entites 作为它们的表示而不是它们的值

标签 php mysql encoding

我想存储以下内容:

$str= "• This is a bullet point";

在我的数据库中作为实际的要点而不是它的 html_entity 值。

我试过:

$new_str = html_entity_decode($str); 

在我将它存储在数据库中之前,然而这似乎只适用于某些 html_entities,例如,它适用于 # 或 & 但不适用于 •

知道我该怎么做吗?...问候 J

最佳答案

$new_str = mb_convert_encoding($str, 'UTF-8', 'HTML-ENTITIES');

关于php - 如何在 mysql 中存储 html_entites 作为它们的表示而不是它们的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10862238/

相关文章:

php - 在 mysql 和 php 中寻找空闲时间 block ?

c# - 我可以阻止 .net 4.0 对单引号进行编码吗?

java - 将 key 字符串转换为 tozny/java-aes-crypto 中的 SecretKeys 对象

php - CakePHP 3 中同一模型的多个关联

php - http ://localhost/not working on Windows 7. 有什么问题?

php - 如何使用dompdf打印页码并将页面边框设置为pdf

javascript - 加载文件,通过电子邮件发送并停留在同一页面上

mysql - 反向内连接

mysql - Node.js MySQL 模型设计

grails - Groovy确定字节数组编码