問題:
如下面內(nèi)容,兩個問題:
1、用正則取得所有圖片地址的php語句怎么寫?
2、取出的多個地址如何一條一條地保存到數(shù)據(jù)庫中?
<p><img alt="" width="153" src="/upload/2009-11-15/9_3.jpg" height="60" /><img src="/upload/2009-11-15/58263668.png" alt="" /><img width="153" height="60" alt="" src="/upload/2009-11-15/155439_2.jpg" />1、什么是在線編輯器 2、fckeditor配置 3、fckeditor的應(yīng)用 4、fckeditor結(jié)合數(shù)據(jù)庫應(yīng)用</p> |
回答:
<?php $str ='<p><img alt="" width="153" src="/upload/2009-11-15/9_3.jpg" height="60" /><img src="/upload/2009-11-15/58263668.png" alt="" /><img width="153" height="60" alt="" src="/upload/2009-11-15/155439_2.jpg" />1、什么是在線編輯器 2、fckeditor配置 3、fckeditor的應(yīng)用 4、fckeditor結(jié)合數(shù)據(jù)庫應(yīng)用</p>'; preg_match_all("/<img.*?src="(.*?)"[^>]*>/i", $str, $match); print_r($match); |