我似乎无法获得这个价值。这是数组:
[1596] => Array
(
[entry_id] => 1596
[title] => This is the article title
[url_title] => url-title-here
[status] => open
[entry_date] => 1304544513
[alt_title] =>
[article_summary] => This is the article summary
[article_intro] => This is the article intro
[article_image] =>
[article_body] => This is the article body
[article_media_id] => 1
[article_videos] =>
[article_media] => Array
(
[0] => Array
(
[row_id] => 3730
[row_order] => 0
[col_id_7] => image
[col_id_12] => right
[col_id_8] => 9781400068609.jpg
[col_id_9] =>
[col_id_10] =>
[col_id_54] =>
)
)
)
我正在尝试使用
构建网址'http://www.domain.com/uploads/media/'.$entry['entry_id']['article_media'][0]['col_id_8']
但它在该图像值的末尾不断给我一个'1'。它应该是9781400068609.jpg,对吗?我有什么不对?
答案 0 :(得分:1)
['entry_id']
正在破坏你的道路。您需要按照其编号(可能在变量中)引用顶级键,如下所示:
$entry_id = 1596;
$valueYouWant = $entry[$entry_id]['article_media'][0]['col_id_8'];
答案 1 :(得分:0)
例如,如果您的数组名为entry
,那么
$entry['entry_id'] == 1596
你必须写:
$entry['article_media'][0]['col_id_8']
答案 2 :(得分:0)
如果$entry
是包含所有条目的数组,则必须指定ID 1596而不是'entry_id'
$entry[1596]['article_media'][0]['col_id_8']
答案 3 :(得分:0)
$entryId = 1596;
$entries[$entryId]['article_media'][0]['col_id_8']