<?php
class ReportsController extends CController
{
public function __call($name,$argument)
{
echo "test";
}
}
?>
This is my Yii controller class and when calling index.php?r=reports/test
URL it has to call the __call
method as test method is not exists but it gives error The system is unable to find the requested action test
error.
Implement missingAction
method in your controller,
As said @xdazz, it checks if method exists and if not it calls missingAction
method.
//This method is invoked when the controller cannot find the requested action.
public function missingAction($actionID)
{
// Your code here
}
This is depending on the implement of the framework.
For example, if the framework implement the code like:
If (!method_exists($controller, $action)) {
throw new Exception("The system is unable to find the requested action $action");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With