求一段正则提取代码解决方法

WBOY
Release: 2016-06-13 11:08:59
Original
709 people have browsed it

求一段正则提取代码
$str='求一段正则提取代码解决方法求一段正则提取代码解决方法';

如以上字符串,将里面的超链接全部提取出来,如果此链接中有类似于 "id=9694595974"(其中id=后面的数字是系统自动生成的,而且数字后面跟的参数有时有 ,有时没有,如上例中的(&ali_refid=a3_620362_1007:1102370186:7:46702465U84y78608587678s868v3I:7178ec8bae50aef3a187075f995ad009&ali_trackid=1_7178ec8bae50aef3a187075f995ad009),可能有有可能没有),将此链接替换为go.php?id=9694595974,并将替换后的链接放回原处,如果原链接没有类似于"id=9694595974"的字符串,将此链接替换为”#“,并放回原处(此字符串中含有多个"id=9694595974"的超链接和多个不含"id=9694595974"的超链接),
------解决方案--------------------
回调函数 如果是类的方法的话,需要用数组形式传递

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!