慕容的工作随笔

慕容的工作随笔

记录学习和工作

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 {

}
}

评论 (0)

还没有评论,来做第一个吧。

发表评论

提交后需管理员审核通过后显示