PHP SimpleXML + Get Attribute

前端 未结 7 1340
猫巷女王i
猫巷女王i 2020-12-01 18:32

The XML I am reading looks like this:



    The Big Bang Theory
    http://www.tvrage.com/The_Bi         


        
7条回答
  •  隐瞒了意图╮
    2020-12-01 18:43

    This should work. You need to use attributes with type (if sting value use (string))

    $id = (string) $xml->show->attributes()->id;
    var_dump($id);
    

    Or this:

    $id = strip_tags($xml->show->attributes()->id);
    var_dump($id);
    

提交回复
热议问题