好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

php获取文章内容里面的图片的方法 - php函数

php获取文章内容里面的图片的方法

function  getpic( $str ){      preg_match_all( "//isU" , $str , $ereg );//正则表达式把图片的整个都获取出来了        $img = $ereg [0][0]; //图片        $p = "#src=('|\")(.*)('|\")#isU" ; //正则表达式       preg_match_all ( $p ,  $img ,  $img1 );        $img_path  = $img1 [2][0]; //获取第一张图片路径   // print_r($img_path);          return   $img_path ;       }    $imgs =getpic( $row [ 'post_content' ]);  $row [ 'post_content' ]  //获取数据库里面的文章的内容。  

查看更多关于php获取文章内容里面的图片的方法 - php函数的详细内容...

  阅读:38次