因此,代碼是PHP:顯示單個數組數據?
$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']
但我得到一個錯誤。 :/
是否使用PDO? – underscore 2013-04-27 13:31:30
你的問題不是你正在打印的東西 - 但是你的'get_gallery'函數返回 - 如果它假設給你一個圖像 - 你不需要返回其他所有的數據 – 2013-04-27 15:34:44