doulangxun7769 2012-02-11 14:47
浏览 25
已采纳

访问对象的单个属性[重复]

Possible Duplicate:
SimpleXML Reading node with a hyphenated name

I am pulling some data for a gaming tournament through an API on this page - http://www.sandwichmuffin.com/muffinleague/

I have been able to access some of the properties seen in the output of the print_r function, for example, to echo the tournament name I simply used

echo $tournaments->tournament[0]->name;

However I am having difficulty doing the same for the 'description-source'. Is there a different way to go about echoing this particular property? Pretty much everything I've tried has resulted in a 0, or false, by my understanding.

Edit: They claim that this (http://challonge.com/api/tournaments) is the format of the XML returned from my API query, if that helps.

  • 写回答

3条回答 默认 最新

  • dongpo1203 2012-02-11 14:50
    关注
    $tournaments->tournament[0]->{"description-source"}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计