weixin_39986973
weixin_39986973
2020-12-05 16:45

Optional variable not working as expected/it did previously

This route used to work in a previous version /client/[a:Action]?/[:ID]?/[**:trailing]? Accessing the route without an action where if Action wasn't defined it would still find the route eg http://altorouter.com/client now it only works if you have an action http://altorouter.com/client/list

Adding a / on line 210 so it does a strpos of '[' fixes this issue 210: } elseif (($position = strpos($route, '/[')) === false) {

该提问来源于开源项目:dannyvankooten/AltoRouter

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39828715 weixin_39828715 5月前

    Try to use the http://altorouter.com/client/ route. Notice the trailing slash.

    点赞 评论 复制链接分享
  • weixin_39986973 weixin_39986973 5月前

    I tired that too, it didn't work... but both work with my suggested code

    点赞 评论 复制链接分享
  • weixin_39828715 weixin_39828715 5月前

    Could you post your routes?

    点赞 评论 复制链接分享
  • weixin_39738416 weixin_39738416 5月前

    That's interesting. Can you create a PR and then add a test for this behavior?

    点赞 评论 复制链接分享

相关推荐