RewriteRule ^/con/([a-z]*)/act/([a-z]*)$ /index.php?con=$1&act=$2&%1
用PHP去正则表达式匹配:
erg.php
用PHP去正则表达式匹配:
erg.php
<?php
$str_temp = "/con/user/act/introl";
preg_match("/^\/con\/([a-z]*)\/act\/([a-z]*)$/i", $str_temp, $out);
print_r($out);
?>
$str_temp = "/con/user/act/introl";
preg_match("/^\/con\/([a-z]*)\/act\/([a-z]*)$/i", $str_temp, $out);
print_r($out);
?>
[root@localhost ~]# php erg.php
Array
(
[0] => /con/user/act/introl
[1] => user
[2] => introl
)
Array
(
[0] => /con/user/act/introl
[1] => user
[2] => introl
)
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/1977/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2009-9-18 21:32
评论列表