Sunday, September 6, 2015

yii Get The First Image From a Post

    public function catch_that_image($str){

        $output = preg_match_all('/]+src=[\'"]([^\'"]+)[\'"][^>]*>/i', $str, $matches);
        return $matches[1][0];

    }

$recentnew->catch_that_image($recentnew->details);

No comments:

Post a Comment