how to get all list of controllers and methods without MY_controller and Ci_controller methods in codeigniter?

144
May 25, 2017, at 4:23 PM

how to get all list of controllers and methods without MY_controller and Ci_controller methods in codeigniter???

Help me!!!!!!

    $this->load->helper('file');
        $controllers = get_filenames( APPPATH . 'controllers/' );
                    foreach( $controllers as $k => $v )
                    {
                        if( strpos( $v, '.php' ) === FALSE)
                        {
                            unset( $controllers[$k] );
                        }
                    }
                    echo '<ul>';
                    foreach( $controllers as $controller )
                    {
                        echo '<li>' . $controller . '<ul>';
                        include_once APPPATH . 'controllers/' . $controller;
                        $methods = get_class_methods( str_replace( '.php', '', $controller ) );
                        foreach( $methods as $method )
                        {
                            echo '<li>' . $method . '</li>';
                        }
                        echo '</ul></li>';
                    }
                    echo '</ul>';
Answer 1

Class not inherit from CI_Controller cannot access codeigniter function

You must use get_instance();

eg.,

Class User
{
   function index()
   {
      $CI =& get_instance();
      $CI->load->library('database');
      $CI->load->view('something');
     /*
      this above code is equal to
      $this->load->library('database');
      $this->load->view('something');
     */
   }
}
READ ALSO
How to call controller function from handler?

How to call controller function from handler?

I have Handlerphp (app/Exceptions/Handler

272
where to put limit and offset?

where to put limit and offset?

this code is written by Codeigniter and it is in the models folder I need to add

203
How to upload image with text field name and preview image with name? [on hold]

How to upload image with text field name and preview image with name? [on hold]

Upload image with select field name and Image Preview with selected name and upload to database ? pls help me

122