您现在的位置: 万盛学电脑网 >> 程序编程 >> 网络编程 >> php编程 >> 正文

CI中view的重写 代码

作者:佚名    责任编辑:admin    更新时间:2022-06-22

 <!--?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
* common class
*
* @package default
* @author mark
**/

class common extends CI_Controller {

public function __construct(){
parent::__construct();
}


/**
* 重写view 使能改变模板文件后缀等
*
* @return void
* @author meigong
**/
function view($file, $data, $flag = false){
if (true === $flag) {
return $this--->load-&gt;view($file.'.tpl', $data, true);
}else {
echo $this-&gt;load-&gt;view($file.'.tpl', $data, true);
}
}

}
?>