Php 从stdClass中提取值
我有这组值,如何使用PHP提取数组?我尝试了echo结果[0];或结果[0]->标题;不起作用:Php 从stdClass中提取值,php,import.io,Php,Import.io,我有这组值,如何使用PHP提取数组?我尝试了echo结果[0];或结果[0]->标题;不起作用: object(stdClass)#1 (6) { ["offset"]=> int(0) ["results"]=> array(16) { [0]=> object(stdClass)#2 (10) { ["image"]=> string(61) "http://ecx.images-amazon.com/i
object(stdClass)#1 (6) {
["offset"]=> int(0)
["results"]=> array(16) {
[0]=> object(stdClass)#2 (10) {
["image"]=> string(61) "http://ecx.images-amazon.com/images/I/513e74vbkBL._AA160_.jpg"
["price_range/_text"]=> string(14) "$6.99 - $23.55"
["price_range"]=> string(161) "http://www.amazon.com/Sinland-Absorbent-Travel-Sports-Microfiber/dp/B00C82RXQM/ref=sr_1_1/175-6400296-2709943?ie=UTF8&qid=1419493024&sr=8-1&keywords=sports+towel"
["image/_alt"]=> string(15) "Product Details"
["title"]=> string(161) "http://www.amazon.com/Sinland-Absorbent-Travel-Sports-Microfiber/dp/B00C82RXQM/ref=sr_1_1/175-6400296-2709943?ie=UTF8&qid=1419493024&sr=8-1&keywords=sports+towel"
["reviews/_source"]=> string(3) "173"
["title/_title"]=> string(112) "Sinland Ultra Absorbent Travel Sports Towels Workout Towel Microfiber Towel Bath Towels Gym Towels Drying Towels"
["title/_text"]=> string(115) "Sinland Ultra Absorbent Travel Sports Towels Workout Towel Microfiber Towel Bath Towels Gym Towels Drying Towels..."
["reviews"]=> float(173)
["sold_by"]=> string(7) "Sinland"
}
[1]=> object(stdClass)#3 (10) {
["image"]=> string(61) "http://ecx.images-amazon.com/images/I/41-H4eV8dvL._AA160_.jpg"
["price_range/_text"]=> string(15) "$13.99 - $20.99"
["price_range"]=> string(160) "http://www.amazon.com/NEW-RatTowels-Microfiber-Sapphire-Emerald/dp/B005HQ7Z8M/ref=sr_1_2/175-6400296-2709943?ie=UTF8&qid=1419493024&sr=8-2&keywords=sports+towel"
["image/_alt"]=> string(15) "Product Details"
["title"]=> string(160) "http://www.amazon.com/NEW-RatTowels-Microfiber-Sapphire-Emerald/dp/B005HQ7Z8M/ref=sr_1_2/175-6400296-2709943?ie=UTF8&qid=1419493024&sr=8-2&keywords=sports+towel"
["reviews/_source"]=> string(3) "284"
["title/_title"]=> string(167) "30% Off - #1 Rated Sport and Travel Towel. SportLite Towels - 100% Microfiber S
将其转换为数组
i、 e
这是你可以在几分钟内从手册中了解到的最基本的东西。另外,我认为使用stdClass作为容器没有多大意义,数组也会做同样的工作。问题是这是导入的结果。io我无法控制它的设置方式。。这就是他们现在给我的,试图找出我们如何提取数据输出到HTML表格的方法。这里也有类似的问题:他想要的只是对象中的数组。
print_r((array)yourObject);