PHP object holding XML data

后端 未结 2 1884
旧时难觅i
旧时难觅i 2021-01-29 08:46

How to check whether any data is returned in Object $twitter_xml for query abc or its empty?

Following is the code:

 $url=         


        
2条回答
  •  遥遥无期
    2021-01-29 09:01

    I'm not sure what Twitter returns, but you should be able to do an isset() on a value you expect to exist.

    See http://php.net/manual/en/function.isset.php

    E.g.

    if(isset($twitter_xml->name))
    {
        // XML has a 'name' element
    }
    else
    {
        // No 'name' element
    }
    

提交回复
热议问题