利用smarty生成静态页实例.
生成页面在根目录.
更多技术文章请移步
http://www.dahuzhi.comclass IndexAction extends GlobalAction {<br>
<br>
public function html()<br>
{<br>
$this->assign('title', '测试静态页标题');<br>
$this->assign('body', '测试静态页内容');<br>
//捕获输出赋值到变量<br>
$output = $this->fetch();<br>
//生成文件<br>
file_put_contents(APP_PATH . '/test.html', $output);<br>
}<br>
}html模版页面<br><br><title>{$title}</title>
<br><br><br>
{$body}<br><br>
AD:真正免费,域名+虚机+企业邮箱=0元
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号