如何在键中使用@检索 SimpleXMLElement 对象值

How to retrieve SimpleXMLElement object value with @ in key

我从 eBay 上退回了这个 API。如何使用 PHP 访问 count 中的值?

(
    [ack] => Success
    [version] => 1.13.0
    [timestamp] => 2020-04-13T00:01:52.128Z
    [searchResult] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [count] => 0
                )

        )
...

我尝试了以下但无济于事

$x->searchResult->@attributes->count;

$x->searchResult['@attributes']->count;

要查看所有属性,请使用

foreach ($xml->searchResult->attributes() as $a=>$b)
    echo "[$a] = $b <BR>";