{"id":633,"date":"2022-08-30T15:04:36","date_gmt":"2022-08-30T15:04:36","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/codeigniter-routing-behavior-with-the-controllers-magic-method-__call-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:04:36","modified_gmt":"2022-08-30T15:04:36","slug":"codeigniter-routing-behavior-with-the-controllers-magic-method-__call-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/codeigniter-routing-behavior-with-the-controllers-magic-method-__call-collection-of-common-programming-errors\/","title":{"rendered":"Codeigniter routing behavior with the controllers magic method __call-Collection of common programming errors"},"content":{"rendered":"<p>In CodeIgniter, there is <code>_remap<\/code>. So if you go to<\/p>\n<blockquote>\n<p>XYZ.com\/Class\/UndefinedMethod\/param1\/param2<\/p>\n<\/blockquote>\n<p>then <code>_remap<\/code> will be called (actually <code>_remap<\/code> will always be called, so we need to make sure that methods that do exist are called correctly).<\/p>\n<pre><code>function _remap($method, $params=array()){\n    $funcs = get_class_methods($this);\n    if(in_array($method, $funcs)){ \/\/ We are trying to go to a method in this class\n        return call_user_func_array(array($this, $method), $params);\n    }\n    \/\/ else do something else\n}\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:09:13. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>In CodeIgniter, there is _remap. So if you go to XYZ.com\/Class\/UndefinedMethod\/param1\/param2 then _remap will be called (actually _remap will always be called, so we need to make sure that methods that do exist are called correctly). function _remap($method, $params=array()){ $funcs = get_class_methods($this); if(in_array($method, $funcs)){ \/\/ We are trying to go to a method in this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-633","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=633"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/633\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}