2

我正在尝试捕获并重新路由以设置字符串开头的所有 url,然后包含正好 5 个字符的段。

即 website.com/coupon/ X1OPA

努力寻找如何做到这一点的例子。

4

2 回答 2

3

这成功了

$route['coupon/([a-zA-Z0-9]{5})']   = 'coupon/apply_code/$1';
于 2013-07-08T03:01:56.053 回答
0

Try following regular expression:

website.com\/coupon\/\w{5}

or

website.com\/coupon\/\w{5}$
  • {5}: exactly 5 copies of previous regular expression should be matched.
  • {m,n}: m ~ n copies of previous regular expresison should be matched.
于 2013-07-08T02:47:13.657 回答