gpt4 book ai didi

PHP:显示单个数组数据?

转载 作者:太空宇宙 更新时间:2023-11-03 12:29:14 25 4
gpt4 key购买 nike

所以代码是

$gallery = get_gallery('gallery_id');
print_r ($gallery);

然后我得到:

Array ( [0] => Array ( [id] => 13 [image] => 0 [user] => 13 [timestamp] => 1366237591 [ext] => png [caption] => Happy smile shi ma? [comment] => ) [1] => Array ( [id] => 14 [image] => 0 [user] => 13 [timestamp] => 1366237954 [ext] => jpg [caption] => Confused [comment] => ) [2] => Array ( [id] => 15 [image] => 0 [user] => 13 [timestamp] => 1366237979 [ext] => jpg [caption] => Facebookerg [comment] => ) [3] => Array ( [id] => 16 [image] => 0 [user] => 13 [timestamp] => 1366377510 [ext] => gif [caption] => lolwut? [comment] => ) [4] => Array ( [id] => 17 [image] => 0 [user] => 13 [timestamp] => 1366380899 [ext] => jpg [caption] => rorwut? [comment] => ) [5] => Array ( [id] => 18 [image] => 0 [user] => 13 [timestamp] => 1366651685 [ext] => jpg [caption] => Notes? [comment] => ) [6] => Array ( [id] => 19 [image] => 0 [user] => 13 [timestamp] => 1366711880 [ext] => jpg [caption] => asd [comment] => ) [7] => Array ( [id] => 20 [image] => 0 [user] => 14 [timestamp] => 1366940983 [ext] => jpg [caption] => Belzelga [comment] => ) )

太好了,终于成功了。但是如何显示单个数据/表格。因为我正试图从这些东西中获得一个“id”。我尝试回显 $gallery['id']但我得到了一个错误。 :/

最佳答案

您需要先访问正确的索引:

$gallery[0]['id']
// ^^^

关于PHP:显示单个数组数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16252667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com