gpt4 book ai didi

php - 电子邮件作为对象名称

转载 作者:可可西里 更新时间:2023-11-01 00:27:12 25 4
gpt4 key购买 nike

我有一个带有名为“电子邮件”的节点的 XML。我使用 simplexml_load_file 来读取文件,但是当我想通过 $row->e-mail 获取行值时,我只得到 0。

这里出了什么问题,所有其他名称都可以正常工作,所以我认为它与“邮件”有关。

发送

最佳答案

来自 the manual

Accessing elements within an XML document that contain characters not permitted under PHP's naming convention (e.g. the hyphen) can be accomplished by encapsulating the element name within braces and the apostrophe.

echo $xml->movie->{'great-lines'}->line;

所以你需要类似的东西

$row->{'e-mail'}

关于php - 电子邮件作为对象名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3637028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com