how to assign var to php template view file

    the function below demo how to assign var to php template view file
    下面的函数显示怎么传递变量到模板文件里
    public function renderInternal($_viewFile_,$_data_=null,$_return_=false)
	{
		// we use special variable names here to avoid conflict when extracting data
		if(is_array($_data_))
			extract($_data_,EXTR_PREFIX_SAME,'data');
		else
			$data=$_data_;
		if($_return_)
		{
			ob_start();
			ob_implicit_flush(false);
			require($_viewFile_);
			return ob_get_clean();
		}
		else
			require($_viewFile_);
	}
Share Post:

About Author

admin

Recommended Posts

3 Comments

Comments are closed for this article!