KnightE
(KnightE)
版主
  
版主
UID 15228
精华
3
积分 95
帖子 3032
金钱 65 喜悦币
威望 30
人脉 0
阅读权限 100
注册 2002-7-13 来自 上海
状态 离线
|
带小妹重帖一下吧~~
<?php function HeighPHPcode($Heightstring){ do{ $z=0; if(preg_match("/<phpcode>(.*?)</phpcode>/s",$Heightstring,$reg)) { $z=1; $code=""; ob_start(); highlight_string($reg[1]); $code = ob_get_contents(); ob_end_clean(); $reg[1] = addslashes($reg[1]); $Heightstring=preg_replace("/<phpcode>(.*?)</phpcode>/s",$code,$Heightstring,1); } }while($z); return $Heightstring; } ########################################################################################## #$PHPcode就是要被加亮的代码
$PHPcode= ' <phpcode> <?php function HeighPHPcode($Heightstring){ do{ $z=0; if(preg_match("/<phpcode>(.*?)</phpcode>/s",$Heightstring,$reg)) { $z=1; $code=""; ob_start(); highlight_string($reg[1]); $code = ob_get_contents(); ob_end_clean(); $reg[1] = addslashes($reg[1]); $Heightstring=preg_replace("/<phpcode>(.*?)</phpcode>/s","$code",$Heightstring,1); } } while($z); return $Heightstring; } ?> </phpcode>'; ##########################################################################################
echo HeighPHPcode($PHPcode); ?>
|
|