PHP程序提取字符串中的视频url地址,可直接使用,使用方法:
get_content_video($contents);
/**
* PHP提取字符串中视频url地址
* @ Linyufan.com
* @ 2018.9.11
*/
function get_content_video($str){
preg_match_all("/<video[^<>]*src=[\"]([^\"]+)[\"][^<>]*>/im",$str,$matches);
return $matches[1];
}
参考小程序: