为什么我在制作预告片,我想从Youtube视频的。。。
自定义字段
$key=“拖车”表示拖车Ex的钥匙(http://www.youtube.com/watch?v=QiNIfGiNiOk WARE key=QiNIfGiNiOk)$key=“img\\U拖车”是youtube 0的img。jpg是youtube视频的时间,这是我手动输入的问题“我可以让youtube时间自动检索吗?如何让代码使用更少的查询?”
这是我的代码:
<?php
$recentPosts = new WP_Query();
$recentPosts-> query(array(\'showposts\' => 4,\'orderby\' => \'rand\', \'post_type\' =>array(\'trailers\')));
?>
<div class="art-Post" >
<div class="art-Post-tl"></div>
<div class="art-Post-tr"></div>
<div class="art-Post-bl"></div>
<div class="art-Post-br"></div>
<div class="art-Post-tc"></div>
<div class="art-Post-bc"></div>
<div class="art-Post-cl"></div>
<div class="art-Post-cr"></div>
<div class="art-Post-cc"></div>
<div class="art-Post-body">
<h2 id="titlu-descriere" class="titlu-d">Trailere care s-ar putea sa-ti placa</h2>
<div class="linie-total"></div>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<div class="box-trailere">
<div class="trailer-img">
<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__(\'Trailer film %s\', \'kubrick\'), the_title_attribute(\'echo=0\')); ?>">
<img src="http://img.youtube.com/vi/<?php $key="trailer"; echo get_post_meta($post->ID, $key, true); ?>/<?php $key="img_trailer"; echo get_post_meta($post->ID, $key, true); ?>">
<span class="duration"><?php $key="time"; echo get_post_meta($post->ID, $key, true); ?></span>
</a>
</div>
<span class="trailer-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></span>
</div>
<?php endwhile; ?>
<div class="cleared"></div>
</div>
</div>
-------------------------------更新-------------------密码告诉我这个
stdClass Object
(
[apiVersion] => 2.1
[data] => stdClass Object
(
[updated] => 2013-02-27T18:12:03.984Z
[totalItems] => 1
[startIndex] => 1
[itemsPerPage] => 25
[items] => Array
(
[0] => stdClass Object
(
[id] => QiNIfGiNiOk
[uploaded] => 2012-11-30T18:20:08.000Z
[updated] => 2013-02-26T22:33:56.000Z
[uploader] => ramonsteck
[category] => Entertainment
[title] => After Earth - Trailer 2013
[description] => Unete www.facebook.com/Cinemovs Historias Paranormales Reales, Películas de Terror Online y proximos estrenos de cine.
[thumbnail] => stdClass Object
(
[sqDefault] => http://i.ytimg.com/vi/QiNIfGiNiOk/default.jpg
[hqDefault] => http://i.ytimg.com/vi/QiNIfGiNiOk/hqdefault.jpg
)
[player] => stdClass Object
(
[default] => https://www.youtube.com/watch?v=QiNIfGiNiOk&feature=youtube_gdata_player
[mobile] => https://m.youtube.com/details?v=QiNIfGiNiOk
)
[content] => stdClass Object
(
[5] => https://www.youtube.com/v/QiNIfGiNiOk?version=3&f=videos&app=youtube_gdata
[1] => rtsp://v1.cache6.c.youtube.com/CiILENy73wIaGQnpiI1ofEgjQhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
[6] => rtsp://v1.cache6.c.youtube.com/CiILENy73wIaGQnpiI1ofEgjQhMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp
)
[duration] => 123
[aspectRatio] => widescreen
[rating] => 2.6722891
[likeCount] => 174
[ratingCount] => 415
[viewCount] => 247218
[favoriteCount] => 0
[commentCount] => 63
[accessControl] => stdClass Object
(
[comment] => allowed
[commentVote] => allowed
[videoRespond] => moderated
[rate] => allowed
[embed] => allowed
[list] => allowed
[autoPlay] => allowed
[syndicate] => allowed
)
)
)
)
)