使用php在iframe中回显youtube视频src

时间:2014-10-11 15:59:08

标签: php html youtube

这就是我想做的事情:

<iframe width="560" height="315" src="//<?php $key="youtubevideo"; echo get_post_meta($post->ID, $key, true); ?>"frameborder="0" allowfullscreen></iframe>

这就是:

<iframe frameborder="0" width="560" height="315" allowfullscreen="" src="//https://www.youtube.com/watch?v=IuRbVuQNppU">

我该如何正确回应?

谢谢

1 个答案:

答案 0 :(得分:1)

试试这个, 改变$ key =&#34; youtubevideo&#34; ----&GT; $键=&#39; youtubevideo&#39;

<iframe width="560" height="315" src="<?php $key='youtubevideo'; echo get_post_meta($post->ID, $key, true); ?>" frameborder="0" allowfullscreen></iframe>