来自XML

时间:2016-01-21 13:28:16

标签: php xml

我向web-sevice发送了请求 -

$result = $s->__call("SubmitXmlString",array($params));

$obj_pros = get_object_vars($result);
$xml =  $obj_pros['SubmitXmlStringResult']; 
$xml = simplexml_load_string($xml);
$array = $xml->int[0]->header;

var_dump ( $array);

这是输出:

object(SimpleXMLElement)[6]
  public 'ItinId' => string '39' (length=2)
  public 'Name' => string 'name of tour' (length=48)
  public 'Class' => string 'STD' (length=3)
  public 'Days' => string '10' (length=2)
  public 'Text' => 
    object(SimpleXMLElement)[8]
  public 'Include' => string 'text for include' (length=1296)
  public 'NotInclude' => string 'text for not include' (length=113)
  public 'Url' => string 'http://www.geotours.co.il' (length=82)
  public 'Status' => string 'OK' (length=2)

如何打印标签" name"值"

1 个答案:

答案 0 :(得分:1)

在您的项目中尝试此代码

$array->Name