Yii-生成静态页
在action中修改render函数参数,添加第三个参数,设置为true文档:
public string render(string $view, array $data=NULL, boolean $return=false)
$view
string
name of the view to be rendered. See getViewFile for details about how the view script is resolved.
$data
array
data to be extracted into PHP variables and made available to the view script
$return
boolean
whether the rendering result should be returned instead of being displayed to end users.
{return}
string
the rendering result. Null if the rendering result is not required.
$out_file = $this->render($view,$data,true);
save_to_html($path, $out_file) ;//此函数仅仅是示例,具体实现自己写。把$out_file存到指定目录,自己命名
unset($outFile);
查看完整版本: Yii-生成静态页
Tags: