- 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'] //獲取數據庫里面的文章的內容。
新聞熱點
疑難解答