用于url的reg表达式无效

时间:2013-02-24 15:13:14

标签: php

$uri="https://www.facebook.com/video/embed?video_id=533502940004820";
$services['facebook']['regexp'] = array('/^https?:\/\/(www\.)?facebook\.com\/video\/embed?video_id=([0-9]*)/', 2);
$services['facebook']['img'] = "https://graph.facebook.com/%s/picture";
$i=1;

    $support=0;
    foreach($services as $service => $s) {
        if(preg_match($s['regexp'][0], $uri, $matches, PREG_OFFSET_CAPTURE) > 0) {
            $support = $i;
        }
        $i++;
    }
    if($support==0){
        echo "This website doesn't support now!";
    }

这是我的代码,但当我将其与 https://www.facebook.com/video/embed?video_id=533502940004820 相匹配时,它无效

谁能告诉我这里有什么问题?

1 个答案:

答案 0 :(得分:1)

embed?video代表“一个或零个”。你必须逃脱它。