Home > Backend Development > PHP Tutorial > 请教关于采集规则的更改

请教关于采集规则的更改

WBOY
Release: 2016-06-23 13:41:10
Original
1095 people have browsed it

我采集别的网站内容是20150123090  我想采集到我网站变成20150123-090    ([\d\-]+?)这是我原来的规则,请问怎么改?


回复讨论(解决方案)

固定在那加上-符号吗?

固定在那加上-符号吗?

是的

采集回来再替换一下就行了。

echo substr_replace('20150123090', '-', 8, 0);  //20150123-090
Copy after login

20150123090  和 20150123-090 用   ([\d-]+?) 就可以了,不用改
如果 - 固定出现在倒数第4位则写作 (\d+-\d{3})

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