CI HMVC:如何从 Modules::run() 检索参数

CI HMVC: How to retrieve params from Modules::run()

我如何检索(和处理)我从这里传入的参数...

Modules::load('MembersList', $this->input->get(NULL, TRUE);

...进入其被传入的模块?

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class MemberList extends MX_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->model('memberslist_model');
    }

    public function index()
    {
        // $params = how_do_i_retrieve it?

        if ( ! isset($list) || $list == 'individuals')
        {
            $data['module'] = 'Individuals';

            $data['results'] = $this->memberslist_model->list_individuals();
            $data['count'] = count($data['results']);

            $data['view'] = $this->load->view('list_individuals', $data, TRUE);
        }

        if ( $list == 'families')
        {
            $data['module'] = 'Families';
        }

        return $this->load->view('memberslist', $data, TRUE);
    }

    public function settings()
    {
        $data['settings'] = $this->memberslist_model->settings();
        return $this->load->view('settings', $data, TRUE);
    }
}

我知道它像 codeigniter 一样作为 URI 段传递,但我已经尝试了所有方法,但我无法让它工作。

我不确定你使用的是哪个版本,但你可以试试这个:

$whatEver = Modules::run('MembersList/index', $this->input->get(NULL, TRUE));

class MemberList extends MX_Controller {

    function __construct()
    {
        parent::__construct();
        $this->load->model('memberslist_model');
    }

    public function index($params)
    {
        print_r($params);
        // $params = how_do_i_retrieve it?

        if ( ! isset($list) || $list == 'individuals')
        {
            $data['module'] = 'Individuals';

            $data['results'] = $this->memberslist_model->list_individuals();
            $data['count'] = count($data['results']);

            $data['view'] = $this->load->view('list_individuals', $data, TRUE);
        }

        if ( $list == 'families')
        {
            $data['module'] = 'Families';
        }

        return $this->load->view('memberslist', $data, TRUE);
    }

    public function settings()
    {
        $data['settings'] = $this->memberslist_model->settings();
        return $this->load->view('settings', $data, TRUE);
    }
}