Home  >  Article  >  Backend Development  >  Ask for advice on replacing the first part of the image address with php regular rules

Ask for advice on replacing the first part of the image address with php regular rules

WBOY
WBOYOriginal
2016-10-24 00:12:431069browse

How to use PHP regular to replace the image address http://img04.taobaocdn.com/ba...!!0-item_pic.jpg_230x230.jpg with https://img.alicdn.com/bao/up...!! 0-item_pic.jpg_230x230.jpg

img04 The 04 number behind it will change

That is, replace http://img0*.taobaocdn.com/ with https://img.alicdn.com/

I tried some methods, but either all of them were replaced or they couldn’t be replaced normally

Reply content:

How to use PHP regular to replace the image address http://img04.taobaocdn.com/ba...!!0-item_pic.jpg_230x230.jpg with https://img.alicdn.com/bao/up...!! 0-item_pic.jpg_230x230.jpg

img04 The 04 number behind it will change

That is, replace http://img0*.taobaocdn.com/ with https://img.alicdn.com/

I tried some methods, but either I replaced them all or it couldn’t be replaced normally

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