php 实现 html转js

[php] <?php function htmltojs($str){ $re=''; $str=str_replace('\','\\',$str); $str=str_replace("'","'",$str); $str=str_replace('"','"',$str); $str=str_replace('t','',$str); $str= split("rn",$str); //已分割成数组 for($i=0;$i<count($str);$i++){ $re.="document.writeln("".$str[$i]."");rn"; //加上js输出 } return $re; } ?> [/php]
相关文章
相关标签/搜索