Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从字符串PHP获取链接_Php_Substring - Fatal编程技术网

从字符串PHP获取链接

从字符串PHP获取链接,php,substring,Php,Substring,我需要一个函数,返回此字符串中视频的所有链接: amf-editor|Joss Whedon||amf-img|<!--dle_image_begin:http://www.cpasbiens.eu/uploads/posts/2015-04/1430088868_avengers-age-of-ultrona.jpg&#124;--><img src="http://www.cpasbiens.eu/uploads/posts/2015-04/1430088868_a

我需要一个函数,返回此字符串中视频的所有链接:

amf-editor|Joss Whedon||amf-img|<!--dle_image_begin:http://www.cpasbiens.eu/uploads/posts/2015-04/1430088868_avengers-age-of-ultrona.jpg&#124;--><img src="http://www.cpasbiens.eu/uploads/posts/2015-04/1430088868_avengers-age-of-ultrona.jpg" alt="AVENGERS: AGE OF ULTRON" title="AVENGERS: AGE OF ULTRON"  /><!--dle_image_end-->||amf-actor|Robert Downey Jr., Chris Evans, Mark Ruffalo||video1|http://videomega.tv/cdn.php?ref=048082108051120119074100048070070048100074119120051108082048&width=660&height=400||video2|https://openload.co/embed/_8xErAYN2yU/Avengers.Age.of.Ultron.2015.720p.BluRay.HD_%7C_www.onlinemovies.is_%7C.mp4||video3|http://vid.ag/embed-vxgzplvnegh8.html

For example :

$video1 = http://videomega.tv/cdn.php?  ref=048082108051120119074100048070070048100074119120051108082048&width=660&height=400

$video2 = https://openload.co/embed/_8xErAYN2yU/Avengers.Age.of.Ultron.2015.720p.BluRay.HD_%7C_www.onlinemovies.is_%7C.mp4

$video3 = http://vid.ag/embed-vxgzplvnegh8.html
amf编辑| Joss Whedon | | amf img | | | amf演员|小罗伯特·唐尼、克里斯·埃文斯、,马克·鲁法洛| |视频1|http://videomega.tv/cdn.php?ref=048082108051120119074100048070070048100074119120051108082048&width=660&height=400||视频2|https://openload.co/embed/_8xErAYN2yU/Avengers.Age.of.Ultron.2015.720p.BluRay.HD_%7C_www.onlinemovies.is_%7C.mp4||视频3|http://vid.ag/embed-vxgzplvnegh8.html
例如:
$1=http://videomega.tv/cdn.php?  ref=04808210805112011907410004807007004810007411912005110808048&宽=660&高=400
$2=https://openload.co/embed/_8xErAYN2yU/Avengers.Age.of.Ultron.2015.720p.BluRay.HD_%7C_www.onlinemovies.is_%7C.mp4
$3=http://vid.ag/embed-vxgzplvnegh8.html

谢谢

这一行正则表达式可能会有所帮助

function make_clickable($text) {
    $regex = '#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#';
    return preg_replace_callback($regex, function ($matches) {
        return $matches[0];
    }, $text);
}

make_clickable($video1);
功能使可点击($text){
$regex='#\bhtps?://[^\s()]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)#;
返回preg_replace_回调($regex,function($matches){
返回$matches[0];
}美元文本);
}
使_可点击($video1);

请阅读并了解如何创建一个SO不是免费的编码或代码转换或调试或教程或库查找服务我们尝试修复您的代码,我们不编写您的代码谢谢Sahil Gulati