return 可以输出对象,但是不可以输出数组

class Index
{
    public function index(Student $student)
    {
       $data = $student->find(25);

       dump($data);
       dump(gettype($data));

       $arr = ['name'=>'qiqi'];

       return ($data);  //$data为对象
    }

}

 

输出:

tp5中的return

 -------------------------------------------------------------------------------------

 

class Index
{
    public function index(Student $student)
    {
       $data = $student->find(25);

       dump($data);
       dump(gettype($data));

       $arr = ['name'=>'qiqi'];

       return ($arr);  //$arr是一个数组
    }

}

 

输出:

tp5中的return

 

相关文章:

  • 2022-12-23
  • 2021-07-12
  • 2021-08-18
  • 2021-12-04
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
猜你喜欢
  • 2022-02-22
  • 2022-12-23
  • 2021-10-27
  • 2022-01-17
  • 2021-07-17
  • 2021-06-02
相关资源
相似解决方案