php - Parsing StdClass Object from file -
i'm using superfeedr php client, , when gets ping, json_encodes , writes ping file. result saved stdclass object. tried load result via file_get_content can not access of data.
$obj = file_get_contents('result.txt'); echo $obj->title;
the object long looks like:
stdclass object ( [status] => stdclass object ( [title] => blah ) [title] => blah )
i haven't used php in long time i'm rusty... seems i'm loading object string can't treat object. right? if so, how approach this?
this not appear "save" object file (which not possible anyway), dumps results of print_r($obj)
file. useful debugging purposes, it's not possible reconstruct actual object this.
you save result of json_encode
file, along lines of this:
{"status":{"title":"blah"},"title":"blah",...}
this can json_decode
'd object or array.
Comments
Post a Comment