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

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

WBOY
WBOYOriginal
2016-06-13 10:37:26955browse

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>
探讨
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
……
Statement:
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