我一直在试图让id字段拉,并不知道我要出错的地方。其余的数据正确拉动,但我试图添加一些新的一些现有的代码,我试过的一切都没有奏效。以下是我的XML和我一直在努力的PHP代码。从一个xml上传中拉出一个特定的字段
我以前没有用过xml和php的组合,所以我真的可以在正确的方向上使用push。
<?xml version="1.0" encoding="UTF-8"?>
<enterprise>
<person>
<sourcedid>
<source>Spirit Awards</source>
<id>SP8675309</id>
</sourcedid>
<userid>...</userid>
<name>
<fn>...</fn>
</name>
<email>...</email>
</person>
PHP代码:
function get_userid(){
return $this->uid;
}
function __construct($xmlData){
$this->uid = (string)$xmlData->id;
}
另外,欢迎使用Stack Overflow。 – rdlowrey 2012-02-28 03:00:41