Home > php教程 > php手册 > body text

preg_match_all匹配文章中的图片作为文章标题的小图片

WBOY
Release: 2016-06-21 08:51:17
Original
1108 people have browsed it


解决方案为匹配到文章中的地址,然后保存到对应字段中

代码如下
$con='


你好哈哈哈,哈哈哈


 



 


你好哈哈哈,哈哈哈


你好哈哈哈,哈哈哈


你好哈哈哈,哈哈哈你好哈哈哈,哈哈哈


你好哈哈哈,哈哈哈你好哈哈哈,哈哈哈


你好哈哈哈,哈哈哈


你好哈哈哈,哈哈哈esrfe123234124

';

$pattern="//";
preg_match_all($pattern,$con,$match);


print_r($match); 

preg_match_all('/php[1-6]/','php5sdfphp4sdflljkphp3sdlfjphp2',$out);
print_r($out);
?>

 

来自PHP100博客,http://zhanglong.php100.com/



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template