读书人

html_entity_decode有关问题

发布时间: 2012-02-14 19:19:19 作者: rapoo

html_entity_decode问题
<?php
require_once("../config.inc.php"); # config
require_once("../connDB.php");
require_once($pathClassLib."/function.common.php");

$rs = $conn->Execute("Select * from `Aboutus` limit 1");

if (!$rs) print $conn->ErrorMsg(); else print "OK!";

print $rs->fields["profile_c"];

?>


。。。。。。

<?=html_entity_decode($rs->fields["profile_c"])?>


这段代码中 上面的print可以正确打印出 profile_c的内容,可是到了下面的html中显示的确是 “fields["profile_c"])?>”。请问各位高手是什么问题啊

[解决办法]
请确认你电脑上的php版本大于4.3.0,html_entity_decode这个函数是php4.3.0才引入的
[解决办法]
你试试用手册上的这个函数试试

PHP code
function unhtmlentities($string)         {            $trans_tbl = get_html_translation_table(HTML_ENTITIES);            $trans_tbl = array_flip($trans_tbl);            return strtr($string, $trans_tbl);        }
[解决办法]
你需要启用短写方式,即 php.ini 中
short_open_tag = on

读书人网 >PHP

热点推荐