我正在尝试使用PHP SDK从parse.com获取订单。我在解析时有 Order 类。 订单类的项目列如下:
[
[
{
"id": "uXtRcVLQ3V",
"name": "Coca cola",
"price": 4,
"thumbnail": "https://parsefiles.back4app.com/taT6ySwwyza3B2MJucucqWz9pMqBZ00Pd7w7hoZf/e8e8d5ee1e5242a1acd759827df41473_pdp-coca-cola-hfcs-2l.png",
"category": {
"id": "cYqrWcCzkt",
"name": "İçecek"
},
"offer": true
},
1
],
[
{
"id": "DWzLluzSpb",
"name": "Darr",
"price": 12,
"thumbnail": "https://parsefiles.back4app.com/taT6ySwwyza3B2MJucucqWz9pMqBZ00Pd7w7hoZf/8d7c0eae7c74d269319fed0a4f4e50e7_bilisim-paylasimlari.jpg",
"category": {
"id": "bGVCMX79Y0",
"name": "Deterjan, Temizlik"
},
"offer": true
},
1
]
]
我希望使用Parse PHP SDK获取并回显数组中每个项目的名称,价格,缩略图和类别。 我的PHP代码的开头是:
$query = new ParseQuery("Order");
$results = $query->find();
答案 0 :(得分:0)
我解决了问题。我使用了嵌套的foreach循环。
def int_to_str(num):
is_negative = False
if num:
num, is_negative = -num, True
s = []
while True:
s.append(chr(ord('0') + num % 10))
num //= 10
if num == 0:
break
return ('-' if is_negative else '') + ''.join(reversed(s))
num = input("Enter any numeric value: ")
print(int_to_str(num))