• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
controller of _remap seem to fail.

#1
Exclamation 
I build a controller: care.php in App\Controllers\wheels,
for simple testing _remap, the code is as follows.

Assuming the URL is 127.0.0.1/myproject/wheels/care/a1, it will get a1 string.
But,assuming the URL is 127.0.0.1/myproject/wheels/care/bb123, the result will appear "Method App\Controllers\wheels\Care::bb123() does not exis",
it is not as directed to the contentProcess function as I expected,
Please give me help.

PHP Code:
namespace App\Controllers\wheels;
 
use 
CodeIgniter\Controller;
 
class 
Care extends Controller {
 
 
   public function _remap($method, ...$params) {
 
       if (method_exists($this$method)) {
 
           return $this->$method(); // go to a1
 
       }else{
 
            return $this->contentProcess();//go to contrntProcess
 
       }
 
   }
 
 
   protected function contentProcess() {
 
       echo 'contentProcess';
 
   }
 
 
   protected function a1() {
 
       echo "a1";
 
   }
 

Reply

#2
What does the relevant route for that look like?
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#3
(02-20-2019, 09:21 PM)kilishan Wrote: What does the relevant route for that look like?

I don't set any relevant route for wheels, it just has default code in route.php


PHP Code:
$routes->get('/''Home::index'); 
Reply

#4
(02-20-2019, 09:21 PM)kilishan Wrote: What does the relevant route for that look like?

PS:  I use codeigniter 4.0.0 alpha5 version, thank you.
Reply

#5
I found this error just when I started development mode.
It maybe have bugs, maybe it?
Reply

#6
Suggestions:
1) Your controller class and source file need to be UCfirst, i.e.
2) the error message says that CI cannot find a bb123() method inside the Care class
3) Is your document root correct? It should be the public folder inside your project. I interpret an URL like yours as looking for App/Controllers/myproject/wheel/Care, which may not be what you intend
Reply

#7
I found the bugs that is route.php of ci debug tool.

I update all packages by Zip compressed file for you testing , thank you.

download
Reply

#8
Sorry - as a general practice I won't download random files from the internet. If you'd like to submit a PR for the fix, that would be great.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#9
(03-02-2019, 12:15 PM)kilishan Wrote: Sorry - as a general practice I won't download random files from the internet. If you'd like to submit a PR for the fix, that would be great.

How to submit a PR for the fix ? Thank you.
Reply

#10
Here are some docs to help out. I believe there's a link in there to find more information.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.