str=" <table> <tr> <td>这里面试内容的文字文章包括‘,。ABCDadfasdf() <img src='/abaa/ccc.jpg' border='0'> </td> </tr> </table>";
preg_match("/>(.+)</",$str,$res);
//取出文本内容
$s = $res[1];
//获得一个随机数$r
$r=rand(0,strlen($s)-1);
//防止分割汉字(不适用与utf8与unicode文件)
if (ord(substr($s,$r,1))>127)
$r++;
$rtxt="";//随机文字
$str = str_replace($s,substr($s,0,$r).$rtxt.substr($s,$r+1));
preg_match("/>(.+)</",$str,$res);
//取出文本内容
$s = $res[1];
//获得一个随机数$r
$r=rand(0,strlen($s)-1);
//防止分割汉字(不适用与utf8与unicode文件)
if (ord(substr($s,$r,1))>127)
$r++;
$rtxt="";//随机文字
$str = str_replace($s,substr($s,0,$r).$rtxt.substr($s,$r+1));
我说不可以
就是不可以
这样不好吧 这些为随机加入的文字内容
$str=" <table> <tr> <td>这里面试内容的文字文章包括‘,。ABCDadfasdf() <img src='/abaa/ccc.jpg' border='0'> </td> </tr> </table>";
preg_match("/>([^<>]+) </",$str,$res);