2、chromium安装(自行百度)
3、控制器实现逻辑(laravel框架)
<?phpob_start() //打开缓冲区
echo "Oh, no no no!"//html内容
$file = 'a.html'
$handle = fopen($file, 'w')
$ob = ob_get_contents()//取得缓冲区内容
fwrite($handle, $ob) //保存HTML
fclose($handle)
ob_end_clean()//清除缓冲区内容
?>
在PHP文件中,可以先对html标签符号进行转义替换,然后做输出,其中 $text 是从表单接收到的 input 的 value 值:<?php
$text=str_replace("<","<",$text) //替换<
$text=str_replace(' " ',""",$text) //替换"
$text=str_replace(">",">",$text) //替换>
echo $text
?>
此时页面输出的就是上面的value,未经Html解析过的。