PHP抓取页面生成HTMl文件简单代码
缓存技术
<?php ob_start();//开启缓存 // $content= ob_get_contents();//从缓存中获取内容 $content=file_get_contents("http://localhost/weizhuan/detail.php?aid=349&uid=1534"); ob_end_clean();//关闭缓存并清空 /***缓存结束***/ file_put_contents("ceshi2.html", $content); echo $content; echo "ok"; ?>
<?php
ob_start();//开启缓存
// $content= ob_get_contents();//从缓存中获取内容
$content=file_get_contents("http://localhost/weizhuan/detail.php?aid=349&uid=1534");
ob_end_clean();//关闭缓存并清空
/***缓存结束***/
file_put_contents("ceshi2.html", $content);
echo $content;
echo "ok";
?>
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。