在WordPress中我使用的是相同的YouTube嵌入代碼,我總是有,但現在它的返回和未定義的錯誤抵消:1 - 我注意到它也適用於在代碼行。PHP錯誤嵌入
function embed_youtube_video($post_id) {
$share_url = get_field('share_url');
preg_match('/youtu\.be\/(.+)$/', $share_url, $matches);
// the next line throws the error
if($matches[1]) {
return '<iframe width="640" height="360" src="http://www.youtube.com/embed/' . $matches[1] . '?rel=0&wmode=transparent" frameborder="0" allowfullscreen></iframe>';
} else {
return false;
}
}
現在我不是一個PHP專家,偷了這些代碼,舊的網站,所以我可能已經做了一些超級簡單修復,只是沒有察覺它。預先感謝您的幫助。
什麼是你的錯誤,並在其中線是什麼呢? – samayo