用正则表达式匹配非括号内的数据?
关注者
13被浏览
10,442登录后你可以
不限量看优质回答私信答主深度交流精彩内容一键收藏
PHP
$str = '{controller}}/cc/{action}/{id}';
preg_match_all('/{.*}(.*){.*}(.*){.*}/U', $str, $matches);
var_dump($matches);
$matches[1] 为 }/cc
$matches[2] 为 /
PHP
$str = '{controller}}/cc/{action}/{id}';
preg_match_all('/{.*}(.*){.*}(.*){.*}/U', $str, $matches);
var_dump($matches);
$matches[1] 为 }/cc
$matches[2] 为 /