【问题标题】:In Codeigniter how to make library wait until view is rendered在 Codeigniter 中如何让库等到视图被渲染
【发布时间】:2021-03-14 00:45:21
【问题描述】:

我想在我的自定义类库触发时显示一个模式,但没有从外部显式调用它的任何方法。

我必须等到视图模板加载完毕。

如何让我的库的方法等到加载视图?

作为第一步,我已经将我的库添加到自动加载数组中。

【问题讨论】:

    标签: php codeigniter codeigniter-3


    【解决方案1】:

    您尝试过 Hooks 吗? 以下可能有效,但不确定。自己没试过。

    $hook['post_controller'] = array(
            'class'    => 'MyClass',
            'function' => 'Myfunction',
            'filename' => 'Myclass.php',
            'filepath' => 'hooks',
            'params'   => array('beer', 'wine', 'snacks')
    );
    

    参考 - https://codeigniter.com/userguide3/general/hooks.html

    【讨论】:

      猜你喜欢
      • 2022-01-22
      • 2016-01-24
      • 1970-01-01
      • 1970-01-01
      • 2011-08-06
      • 1970-01-01
      • 1970-01-01
      • 2017-05-07
      • 1970-01-01
      相关资源
      最近更新 更多