php - Selepas data JSON diformat, susunan data berubah
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-07-01 09:11:58
0
2
999
{"Code":"0","Result":{"Orders":{"171865304":{"LastId":30351,"Time":"2017-06-28T14:56:28+08:00","OrderId":171865304,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-07-18T00:00:00+08:00","DepartureDate":"2017-07-19T00:00:00+08:00","TotalPrice":8,"NumberOfRooms":1,"AffiliateConfirmationId":"1326","OriginStatus":"D"},"171865316":{"LastId":30360,"Time":"2017-06-28T15:02:20+08:00","OrderId":171865316,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-07-18T00:00:00+08:00","DepartureDate":"2017-07-19T00:00:00+08:00","TotalPrice":8,"NumberOfRooms":1,"AffiliateConfirmationId":"1327","OriginStatus":"D"},"171865325":{"LastId":30361,"Time":"2017-06-28T15:05:05+08:00","OrderId":171865325,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-07-18T00:00:00+08:00","DepartureDate":"2017-07-19T00:00:00+08:00","TotalPrice":8,"NumberOfRooms":1,"AffiliateConfirmationId":"1328","OriginStatus":"D"},"171865326":{"LastId":30362,"Time":"2017-06-28T15:05:59+08:00","OrderId":171865326,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-07-18T00:00:00+08:00","DepartureDate":"2017-07-19T00:00:00+08:00","TotalPrice":8,"NumberOfRooms":1,"AffiliateConfirmationId":"1329","OriginStatus":"D"},"171865327":{"LastId":30363,"Time":"2017-06-28T15:11:32+08:00","OrderId":171865327,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-07-18T00:00:00+08:00","DepartureDate":"2017-07-19T00:00:00+08:00","TotalPrice":8,"NumberOfRooms":1,"AffiliateConfirmationId":"1330","OriginStatus":"D"},"171865294":{"LastId":30378,"Time":"2017-06-28T15:37:05+08:00","OrderId":171865294,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-06-28T00:00:00+08:00","DepartureDate":"2017-06-29T00:00:00+08:00","TotalPrice":70,"NumberOfRooms":1,"AffiliateConfirmationId":"314243799193660","OriginStatus":"D"},"171865125":{"LastId":30440,"Time":"2017-06-28T16:57:08+08:00","OrderId":171865125,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-07-06T00:00:00+08:00","DepartureDate":"2017-07-07T00:00:00+08:00","TotalPrice":601,"NumberOfRooms":1,"AffiliateConfirmationId":"H170627110452902933","OriginStatus":"D"},"171865382":{"LastId":30485,"Time":"2017-06-28T18:26:32+08:00","OrderId":171865382,"Status":-6,"PayStatus":-1,"ArrivalDate":"2017-07-18T00:00:00+08:00","DepartureDate":"2017-07-19T00:00:00+08:00","TotalPrice":8,"NumberOfRooms":1,"AffiliateConfirmationId":"1331","OriginStatus":"D"}}},"Guid":"afcbafd4-0831-43bf-8daf-6a605f0fcc05"}

Di atas adalah data mentah JSON.
Saya memintanya menggunakan posmen, dan kemudian saya mendapati bahawa susunan tatasusunan telah berubah selepas pemformatan, kerana saya menghadapi masalah pengisihan tatasusunan saya menyemak kod itu untuk masa yang lama dan mendapati bahawa tiada masalah, tetapi kemudian Saya mendapati bahawa terdapat ralat pemformatan. Bolehkah saya bertanya apa yang mungkin menjadi sebab untuk ini?
Berikut ialah tangkapan skrin berformat Jelas sekali nilai pertama dalam kod sumber ialah 171865304

曾经蜡笔没有小新
曾经蜡笔没有小新

membalas semua(2)
小葫芦

Kerana ini adalah objek, dan objek itu penuh dengan pasangan nilai kunci, dan susunannya adalah rawak. Urutan khusus ditentukan oleh penyemak imbas itu sendiri. Jika anda ingin memesan, adalah disyorkan untuk menukar objek jenis ini kepada tatasusunan dalam format berikut:

[
    { .... },
    { .... },
    { .... },
    { .... }
]
Peter_Zhu

Kerana Pesanan anda adalah objek, bukan tatasusunan

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!