가 어떻게이 동영상의 각 통해 액세스 및 루프이 배열을 분할 가겠어요이 다차원 배열 ...분할
array(1) {
[0]=> array(2)
{
[0]=> array(3)
{
["title"]=> string(27) "A test title for this video"
["video_item"]=> string(70) "http://dev.test/wp-content/uploads/2014/01/1.Introduction3.mp4"
["video_image"]=> string(78) "http://dev.test/wp-content/uploads/2014/01/1.Introduction3_thumb23.jpg"
}
[1]=> array(3)
{
["title"]=> string(13) "asdf fads fad"
["video_item"]=> string(67) "http://dev.test/wp-content/uploads/2014/01/Spring-Mower.mp4"
["video_image"]=> string(75) "http://dev.test/wp-content/uploads/2014/01/Spring-Mower1_thumb6.jpg"
}
}
}
이
작동하지 내가 분명히 사용하고 있지만하고있는 코드의 일부입니다// this gets the array
$videos = get_post_meta(get_the_ID(), 'video_items', false);
$vid = array();
$img = array();
foreach($videos as $video) {
$vid[] = $video['video_item'];
$img[] = $video['video_image'];
}
어떤 방법으로 배열을 분할 하시겠습니까? 출력의 예가 좋을 것입니다. – wallyk
당신은'foreach ($ videos [0] as $ video) '를 사용할 수 있습니다. –
내 답변을보세요. 배열 내에 배열이 있습니다. 따라서 원래 배열의 첫 번째 요소 인 내부의 각 배열을 반복하기 전에 관심이 있습니다. – Pavan