超级对象未加载到 codeigniter 的钩子中

superobject not loaded in hook at codeigniter

当我在 codeigniter 中加载挂钩时,挂钩成功加载但超级对象没有。

public function __construct() {
    $this->CI =& get_instance();
    // This gives me nothing
    print_r($this->CI);
    // This works fine
    echo "Hello!";

} 

codeigniter 版本:3.1.0

有什么想法吗?

您应该使用 post_controller_constructorpost_controller ,而不是 pre_controllerpre_system.

检查docs

No routing or other processes have happened at this point.