Home > Backend Development > PHP Tutorial > php写个页面,在mysql数据库掏出地址,用正则替换图片地址

php写个页面,在mysql数据库掏出地址,用正则替换图片地址

WBOY
Release: 2016-06-13 13:14:18
Original
886 people have browsed it

php写个页面,在mysql数据库取出地址,用正则替换图片地址
php写个页面,在mysql数据库取出地址,用正则替换图片地址

这是一个网址/huwaixie-b0-min0-max0-attr0-6-goods_id-DESC/images/201204/thumb_img/622_thumb_G_1333582619422.jpg
替换为
images/201204/thumb_img/622_thumb_G_1333582619422.jpg

要求完整页面代码

------解决方案--------------------
简单的来一个

PHP code

<?php $html="/huwaixie-b0-min0-max0-attr0-6-goods_id-DESC/images/201204/thumb_img/622_thumb_G_1333582619422.jpg";
$mode='/(images).*/';

preg_match_all($mode,$html,$arr);
print_r($arr[0]);
?>
<br><font color="#e78608">------解决方案--------------------</font><br>
Copy after login
探讨
php写个页面,在mysql数据库取出地址,用正则替换图片地址

这是一个网址/huwaixie-b0-min0-max0-attr0-6-goods_id-DESC/images/201204/thumb_img/622_thumb_G_1333582619422.jpg
替换为
images/201204/thumb_img/622_thumb_G_1333582619422.jpg
……
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template