$info = $this->request->post();//传入的json是个数组。 if(empty($info['企业名称']) || empty($info['企业简称']) || empty($info['纳税人识别号']) || empty($info['企业法人代表']) || empty($info['联系人']) || empty($info['联系人邮箱']) || empty($info['企业电话']) || empty($info['联系人手机']) || empty($info['银行名称']) || empty($info['银行账号']) || empty($info['详细地址']) || empty($info['地区编码']) || empty($info['城市名称']) || empty($info['营业执照照片']) || empty($info['token'])){ return json_encode(['code'=>2,'msg'=>'所有信息必须填写不能为空!','data'=>[]]);
There is a piece of code like this. Simply put, it is to determine whether there are these Info fields. They cannot be less or empty. Is there any better way to write it?
Yes, you can write them separately
Writing like this is too poor in maintainability and efficiency, just take it apart and write