This article mainly introduces the code that displays the YouTube video thumbnail and the Vimeo video thumbnail, you need friends can refer to the following
Code as follows: function Video_image ($url) { $image _url = Parse_url ($url); if ($image _ url[' host '] = = ' www.youtube.com ' | | $image _url[' host '] = = ' youtube.com '] { $array = Explod E ("&", $image _url[' query ')); return "http://img.youtube.com/vi/". substr ($array [0], 2). " /0.jpg "; }else if ($image _url[' host '] = = ' www.youtu.be ' | | $image _url[' host '] = = ' youtu.be ') { &NB SP; $array = explode ("/", $image _url[' path ')); return "0.jpg"; }else if ($image _url[' host '] = = ' Www.vimeo.com ' | | $image _url[' host '] = = ' vimeo.com ') { $hash = uns Erialize (file_get_contents ("http://vimeo.com/api/v2/video/") &NBSP;SUBSTR ($image _url[' path '], 1. ". PHP ")); return $hash [0]["Thumbnail_medium"]; &NBSP} <img src= "<?php Echo video_image (' YouTube URL ');?>"/>