public function index()
{
$path=ROOT_PATH . 'public/html/index.html';
if(file_exists($path)){
echo "我是静态的";
include ($path);
exit;
}else{
$data=Db::table('sun')
->select();
$this->assign('data',$data);
$arr=$this->fetch('index');
file_put_contents($path,$arr);
echo '来自表';
echo $arr;
// return view('index');
//
}
}
//ob 函数静态化页面
ob_start();
echo "Hello World!";
$content = ob_get_contents();//取得php页面输出的全部内容
$fp = fopen("./0001.html", "w");
fwrite($fp, $content);
fclose($fp);