首页 > 开发 > PHP > 正文

CI中view的重写 代码

2024-05-04 21:54:37
字体:
来源:转载
供稿:网友

 <!--?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);
}
}

}
?> 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表