-4
public function processApi(){
$func = strtolower(trim(str_replace("/","",$_SERVER['REQUEST_URI']))); //echo $func;
if((int)method_exists($this,$func) > 0)
$this->$func();
else
$this->response('',404);
echo '404'; // If the method not exist with in this class, response would be "Page not found".
}
感谢回答。 ,但仍然错误。 错误是:意外'' – jerry
如果您使用MVC结构,所以得到错误,但使用核心oops没有得到error.so如果您将使用MVC尝试$ this-> router-> fetch_method();替换$ _SERVER ['REQUEST_URI'] –
我使用了核心代码。 – jerry