我想弄清楚為什么 isset 不適用于 $this 變量?我正在使用 HMVC codeigniter 并嘗試檢查模塊是否加載成功:$this->load->module('welcome');var_dump(isset($this->welcome));print_r($this->welcome);結果是:bool(false) --- This is the result of isset. Below is result of var_dumpWelcome Object( [autoload] => Array ( ) [load] => MY_Loader Object ( [_module:protected] => welcome [_ci_plugins] => Array ( ) [_ci_cached_vars] => Array ( ) ... some other protected variables [controller] => Welcome Object *RECURSION* ))為什么isset返回false?
1 回答

holdtom
TA貢獻1805條經驗 獲得超10個贊
在深入檢查 CodeIgniter 核心文件后,我發現有一種方法可以檢查它:
if(!isset(Modules::$registry['welcome'])) { // check module loaded
return jsonError(2);
}
// module loaded. Go ahead
- 1 回答
- 0 關注
- 95 瀏覽
添加回答
舉報
0/150
提交
取消