编辑器的测试

<?php
    public function comment($content)
    {
       preg_match_all("/\[.+?\]/i", $content,$arr,PREG_PATTERN_ORDER); //根据[]匹配表情
       $out =$content;
       foreach($arr[0] as $k=>$v)
       {
          $arr1[$k]=M('expression')->where("emotion='".$v."'")->find(); 
          $out = ereg_replace("\[".$arr1[$k]['title']."\]","<img src=\"__PUBLIC__/expression/".$arr1[$k]['filename']."\" />",$out);
       }
       return $out;
    }
?>

你可能感兴趣的:(编辑器的测试)