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.
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";
}
}