这几天看了一些代码,记录下,下次也自己这样写
1、&&的使用
'complete' != $this->request->action() && $this->checkInstall();在&&右边进行判断,如果为真就不执行右边,如果用其他写法就是一堆 if else。
2、经常我们要用到一个页面form中post提交一些信息
public function step2($db = null, $admin = null) {
//是否get请求 未提交前
if (request()->isGet()) {
return $this->fetch('step2');
}
//...省略提交处理过程 post之后的操作
}觉得省略了很多代码 也清晰多了 