tp5请求和助手函数

是否为 GET 请求

if (Request::instance()->isGet()) echo "当前为 GET 请求";

/是否为 POST 请求

if (Request::instance()->isPost()) echo "当前为 POST 请求";

是否为 PUT 请求

if (Request::instance()->isPut()) echo "当前为 PUT 请求";

是否为 DELETE 请求

if (Request::instance()->isDelete()) echo "当前为 DELETE 请求";

是否为 Ajax 请求

if (Request::instance()->isAjax()) echo "当前为 Ajax 请求";

是否为 Pjax 请求

if (Request::instance()->isPjax()) echo "当前为 Pjax 请求";

是否为手机访问

if (Request::instance()->isMobile()) echo "当前为手机访问";

 

 

 

助手函数

是否为 GET 请求

if (request()->isGet()) echo "当前为 GET 请求";

posted @ 2020-04-21 09:36  静静地开始  阅读(362)  评论(0)    收藏  举报