Notice: Trying to get property of non-object in

前端 未结 1 1414
忘掉有多难
忘掉有多难 2021-01-24 19:46

I\'m learning a bit of PHP. It\'s supposed to print 0, however I get an error:

Notice: Trying to get property of non-object in...

相关标签:
1条回答
  • The brackets on the outside of your JSON string are causing it to be an object inside of an array.

    You can access the object by specifying which array member you want with $obj[0]->{'qty'};

    OR change your json string so it instantiates into an object directly.

    $json = '{"assetref":"","qty":0,"raw":0}';
    
    0 讨论(0)
提交回复
热议问题