$path = public_path() . '/view/index.html';
if (file_exists($path) && time() - filemtime($path) > 60) {
//页面静态化
ob_start();
$htmlStrings = view('home.index')
->with('links', $links)
->with('config', $config)
->with('category', $cagegory)
->__toString();
echo $htmlStrings;
file_put_contents('view/index.html', ob_get_clean());
}
//输出静态文件
\View::addExtension('html', 'php');//扩展名
echo view()->file(public_path() . '/view/index.html');