PHP抓取页面生成HTMl文件简单代码

时间:2022-11-13 08:41:56
缓存技术
<?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";
?>