我正在使用以下所有内容从我的数据库中获取一个名为“代码”的字段,删除所有 HTML 实体,并将其“照常”打印到网站:
<?php $code = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $code);
$code = preg_replace('~&#([0-9]+);~e', 'chr("\\1")', $code);
$code = html_entity_decode($code); ?>
但是导出的代码仍然如下所示:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’img/the_image.png’);
看看那里发生了什么?我可以在字符串上运行多少其他东西来将它们变成该死的常规字符?!
谢谢!
杰克