我拥有和对象数组,如下所示。我无法添加到此对象数组,因为我不断收到错误。 这里是如何在当下:将SimpleXMLElement对象添加到数组中
SimpleXMLElement Object
(
[url] => Array
(
[0] => SimpleXMLElement Object
(
[loc] => http://jbsoftware.co.uk/
[lastmod] => 2015-02-02
[changefreq] => monthly
[priority] => 1.0
)
)
)
现在加入到这个月底我做了以下内容:
$note="
<url>
<loc>{$actual_link}</loc>
<lastmod>{$date}</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
";
$sxe = new SimpleXMLElement($note);
$page[] = $sxe;
而这又为我提供了这个错误....
Fatal error: controller::generateSitemap() [<a href='controller.generatesitemap'>controller.generatesitemap</a>]: Cannot create unnamed attribute
任何人都可以请让我知道为什么我不能简单地将其添加到当前对象数组的末尾? 这一个真的让我难住。
SimpleXMLElement对象_不是数组_,它们的行为就像数组_在某些方面_。 – CBroe 2015-02-09 13:42:38