Object of class stdClass could not be converted to string

后端 未结 6 967
时光说笑
时光说笑 2020-12-01 11:45

I am having a problem with PHP at the moment, I am getting this error,

Object of class stdClass could not be converted to string the error occurs when

6条回答
  •  [愿得一人]
    2020-12-01 12:37

    You mentioned in another comment that you aren't expecting your get_userdata() function to return an stdClass object? If that is the case, you should mind this line in that function:

    return $query->row();
    

    Here, the CodeIgniter database object "$query" has its row() method called which returns an stdClass. Alternately, you could run row_array() which returns the same data in array form.

    Anyway, I strongly suspect that this isn't the root cause of the problem. Can you give us some more details, perhaps? Play around with some things and let us know how it goes. We can't play with your code, so it's hard to say exactly what's going on.

提交回复
热议问题