Fatal error: Cannot use object of type User as array

前端 未结 1 998
既然无缘
既然无缘 2021-01-19 17:39

The users on the application are logged in by their e-mail. This e-mail is in a session. With this session I try to get more information of that user to print out there (sur

1条回答
  •  一个人的身影
    2021-01-19 18:38

    It is because you are using the $user object as an array (as the error message makes perfectly clear).

    Change:

    var_dump($user['avatar']);
    

    To this:

    var_dump($user->avatar);
    

    0 讨论(0)
提交回复
热议问题