我在数据库中有一些数据需要在XML文件中表示,但每个请求的数据都不同,因此XML文件是通过PHP生成的.例如,让我们说这是db中的文本:
Hello & Goodbye
我已经尝试使用以下内容来获取上面的内容(设置为$example变量),以便Hello & Goodbye在生成的XML中显示:
$example = mb_convert_encoding($example, "utf-8", "HTML-ENTITIES" );
$example = htmlspecialchars_decode($example);
$example = html_entity_decode($example);
$example = str_replace("&", "&", $example);
这些行将替换其他实体,例如",取代其正确的字符,但不是&.知道如何正常工作吗?
| 归档时间: |
|
| 查看次数: |
3922 次 |
| 最近记录: |