0

可能重复:
PHP/JSON - stdClass 对象

我有这个 JSON 响应:

{
    "findItemsIneBayStoresResponse": {
        "ack": "Success",
        "version": "1.12.0",
        "timestamp": "2012-11-09T17:14:20.543Z",
        "searchResult": {
            "@attributes": {
                "count": "1"
            },
            "item": {
                "itemId": "160884918999",
                "topRatedListing": "false"
            }
        },
        "paginationOutput": {
            "totalPages": "1",
            "totalEntries": "1",
            "pageNumber": "1",
            "entriesPerPage": "100"
        }
    }
}

我正在尝试使用 PHP 访问“@attributes”中的“计数”。我认为if ($decoded->findItemsIneBayStoresResponse->searchResult->@attributes->count > 1) {会工作,但我得到了错误:

Parse error: syntax error, unexpected '@', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/ancienta/public_html/category.php on line 40

我能做些什么?

4

0 回答 0