function wailian_replace($content) 
    { 
        $preg_searchs = "/\<a href\=\"http\:\/\/(.+?)\"/ie"; 
        $preg_replaces = '$this->iframe_url(\'\\1\')';    
        $content = preg_replace($preg_searchs, $preg_replaces, $content);        return $content; 
    } 
不太懂正则,不知道如何修改e修饰符来兼容php7  求助大神

解决方案 »

  1.   


    function wailian_replace($content) 
        { 
            $preg_searchs = "/\<a href\=\"http\:\/\/(.+?)\"/i"; 
            $content = preg_replace_callback($preg_searchs, function($matches){  
    return $this->iframe_url($matches[1]);  
    }, $content);        return $content; 
        } 
      

  2.   

        function wailian_replace($content) 
        { 
            $preg_searchs = "/\<a href\=\"http\:\/\/(.+?)\"/i"; 
            $content = preg_replace_callback($preg_searchs,function($m) {  return $this->iframe_url($m[1]); }, $content);
            return $content; 
        }