发新话题
打印

preg_replace正则小笔记

preg_replace正则小笔记

要把
andy/23423.html
替换成
andy.php?id=23423

两种写法

preg_replace("/andy\/([0-9]+)\.html/","andy.php?id=\\1",$data);
preg_replace("'andy/([0-9]+).html'","andy.php?id=$1",$data);
感谢几位兄弟的帮助:)
本帖最近评分记录

TOP

发新话题
Powered by Discuz! 6.0.0  © 2001-2007 Comsenz Technology Ltd
Processed in 0.190346 second(s), 7 queries, Gzip enabled
当前时区 GMT+8, 现在时间是 2008-9-7 14:13 皖ICP备06000549 清除 Cookies - 联系我们 - 火车采集器官方站 - 静态归档