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」の「count」にアクセスしようとしています。うまくいくと思い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