Welcome Guest, Not a member yet? Register   Sign In
Bug? CI 4 not remove method from params when use routes ?
#2

In CI 3 i use this _remap in MY_Controller and work perfectly for my app.
PHP Code:
public function _remap($method$params = array()) {
        if ( method_exists($this$method) ) {
            return call_user_func_array(array($this$method), $params);
        } elseif ( method_exists($this'index') ) {
            
$this->router->method 'index';
            
$this->router->uri->rsegments[2] = 'index';
            return 
call_user_func_array(array($this'index'), $params);
        } else {
            
show_404();
        }
    } 

For some days i try to find a good solution for this _remap in CI 4 for migrate my app to ci 4. 

Original url: site[.]com/post/seo-url/param1/param2

$routes->add('p(/.*)?', 'Post::index');
$routes->add('post(/.*)?', '404');

After route: site[.]com/p/seo-url/param1/param2
But in CI4 i received empty params after use this route in _remap
In CI3 i received params without method and folders in _remap

I need receive params without method and folders in CI 4 _remap.

Can someone help me please ? Thank you!
Reply


Messages In This Thread
RE: Bug? CI 4 not remove method from params when use routes ? - by cvlancvlan - 06-28-2020, 11:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB