|
楼主 |
发表于 2010-11-2 20:13:15
|
显示全部楼层
我网上查了一个,只是很奇怪为什么CI不把这个函数做到库里。
<?
function HtmlEncode($fString)
{
if($fString!="")
{
$fString = str_replace( '>', '>',$fString);
$fString = str_replace( '<', '<',$fString);
$fString = str_replace( chr(32), ' ',$fString);
$fString = str_replace( chr(13), ' ',$fString);
$fString = str_replace( chr(10) & chr(10), '<br>',$fString);
$fString = str_replace( chr(10), '<BR>',$fString);
}
return $fString;
}
function EncodeHtml($fString)
{
if($fString!="")
{
$fString = str_replace(">" , ">", $fString);
$fString = str_replace("<", "<", $fString);
$fString = str_replace(" ",chr(32),$fString);
$fString = str_replace("",chr(13),$fString);
$fString = str_replace("<br>",chr(10) & chr(10),$fString);
$fString = str_replace("<BR>",chr(10),$fString);
}
return $fString;
}
?> |
|