$template = preg_replace(
"/\<a href\=\"category\.php\?id\=(\d+)(&page\=(\d+))?\"([^\>]*)\>/e",
"rewrite_category('\\1', '\\3', '\\4')",
$template
); function rewrite_category($fid, $page = 0, $extra = '') {
return '<a href="category-'.$fid.'-'.($page ? $page : 1).'.html"'.stripslashes($extra).'>';
}$template是模板内容可是<a href="category.php?id=xxx">这样的链接为什么没有变化呢?
"/\<a href\=\"category\.php\?id\=(\d+)(&page\=(\d+))?\"([^\>]*)\>/e",
"rewrite_category('\\1', '\\3', '\\4')",
$template
); function rewrite_category($fid, $page = 0, $extra = '') {
return '<a href="category-'.$fid.'-'.($page ? $page : 1).'.html"'.stripslashes($extra).'>';
}$template是模板内容可是<a href="category.php?id=xxx">这样的链接为什么没有变化呢?
1.这里不能有两个括号
2.&应该为&