thinkphp5.1中判断IS_POST方法 转

转自:https://blog.csdn.net/foreverlikui/article/details/88974590

之前使用3.2版本时,经常会使用到

if(IS_POST){

}else{

}
在thinkphp5.1中,废除了IS_POST。

thinkphp5.1中,我们可以这样用,

控制器中引入

use think\facade\Request;
public function index()
{
if(Request::isPost()){
//这样判断

} else {

}
}

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注