/** * 构造方法 * * 用于初始化本类的运行环境,或对基本变量进行赋值 * * @access public * @return boolean */ public function __construct() { //时区设置,默认为中国(北京时区) date_default_timezone_set(Configure::get('application.defaultTimeZone')); //设置异常处理 set_exception_handler(array($this, '_exception')); //关闭魔术变量,提高PHP运行效率 if (get_magic_quotes_runtime()) { @set_magic_quotes_runtime(0); } //将全局变量进行魔术变量处理,过滤掉系统自动加上的'\'. if (get_magic_quotes_gpc()) { $_POST = $_POST ? $this->_stripSlashes($_POST) : array(); $_GET = $_GET ? $this->_stripSlashes($_GET) : array(); $_SESSION = $_SESSION ? $this->_stripSlashes($_SESSION) : array(); $_COOKIE = $_COOKIE ? $this->_stripSlashes($_COOKIE) : array(); } //实例化视图对象 self::$_viewObject = $this->initView(); //回调函数,实例化控制器(Controller)时,执行所要补充的程序 $this->init(); return true; }