preg_replace:
2010-02-22

preg_replace正则

3+

引用21andy的博文,备忘一下,以记录php使用过程中preg_replace正则应用。

要把
xxx/12345.html
替换成
xxx.php?id=12345

两种写法

preg_replace("/xxx\/([0-9]+)\.html/","xxx.php?id=\\1",$data);
preg_replace("'xxx/([0-9]+).html'","xxx.php?id=$1",$data);