Why can't tp5 return an array?
PhpNewer
PhpNewer 2018-05-13 18:52:43
0
2
1474
//后台管理员验证方法
  public function check(Request $request){
    //初始返回的三个参数
    $status = 0;
    $result = '';
    $data = $request->param();
    
    //return ['status'=>$status,'message'=>$result,'data'=>$data];

    $returnVar=array('status'=>$status,'message'=>$result,'data'=>$data);
    //dump($returnVar); //能正确显示
    return $returnVar; //返回给前端为什么会提示返回数据类型错误呢?

  }

Why can’t I use return to return an array? Why does an error occur?


PhpNewer
PhpNewer

reply all(2)
a'ゞ时间

tp5 control layer returns json by default

PHPNEWER

Supplement: Can’t the tp5 array be returned with return?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template