Created
May 27, 2015 20:20
-
-
Save avuenja/8b6c74e37a0336f8015a to your computer and use it in GitHub Desktop.
link youtube automatico
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$video = "https://www.youtube.com/watch?v=1tnYpkt5G2g"; // $video recebe o valor da url do youtube (link) | |
preg_match('/(v\/|\?v=)([^&?\/]{5,15})/', $video, $x); // Faz o preg_match para retirar caracters | |
?> | |
<!-- Exibe o video --> | |
<object width="560" height="315"> | |
<param name="movie" value="//www.youtube.com/v/<?php print end($x); ?>?hl=pt_BR&version=3&rel=0"></param> | |
<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> | |
<embed src="//www.youtube.com/v/<?php print end($x); ?>?hl=pt_BR&version=3&rel=0" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed> | |
</object> |
Author
avuenja
commented
Aug 16, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment