-
Notifications
You must be signed in to change notification settings - Fork 0
Controller
axios edited this page Oct 8, 2020
·
5 revisions
Get details from the \tpr\Controller code.
Provide inheritance to controller subclasses
namespace app\index\controller;
use tpr\Controller;
class Index extends Controller
{
public function index()
{
$this->response(["hello, world!"]);
}
}
- return normal reponse
$this->response($result = '', $status = 200, $msg = '', array $headers = []);
- return success response
$this->success($data = []);
- return error response
$this->error($code = 500, $msg = 'error');
- return html content
more detail in Views document
return $this->fetch(string $template = '', array $vars = []);
- redirect
$this->redirect(string $destination, bool $permanent = true);
Anything unclear or inaccurate? Please let me know at axioscros@aliyun.com