When I try to access info that is not presented in xml like so: $someInfo = $element->blabla->cats[0]->src; PHP shows notice like this: Notice: Trying to get property of non-object How would I settle the matter?
Just check if the specific element is set befor accessing data:
if(isset($element->blabla->cats[0]->src)){
$someInfo = $element->blabla->cats[0]->src;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.