Regular Expression
Example:
<?php
$pattern = '/<img.*?src="(.*?)" .*?\/>/';
preg_match_all($pattern, $content,$img_arr);
print_r($img_arr);
?>
Source:
$content="<p> <img class="alignnone size-full wp-image-40188" src="http://img2.localhost/img/news/78/e2/78e2780f351d33ca38b93c677bc9578a.jpg" alt="18" width="750" height="500" />
If you are reading this article, chances are you are a Project Management Professional (PMP) and then you know what PDU stands for.
<img class="alignnone size-full wp-image-40186" src="http://img2.localhost/img/news/22/a6/22a66b54003dc506eea9b7fc93299723.jpg" alt="7" width="750" height="500" />
If not, Professional Development Units (PDU) are like credits that every PMP needs to earn in order to keep their certification.
<img class="alignnone size-full wp-image-40187" src="http://img2.localhost/img/news/2d/66/2d66c300244ef31e57790203bea0870d.jpg" alt="18" width="750" height="500" /> >> </strong> <strong>http://housetube.tw</strong> <strong> </strong> </p>";
Reslut:
$img_arr
沒有留言:
張貼留言