dongmi4720 2015-09-02 19:32
浏览 90
已采纳

路由参数是URL编码的

I'm trying out Lumen and I've written my first route:

$app->get('hello/{name}', function ($name) {
    return "Hello, $name!";
});

The documentation I've read so far doesn't say a word about how the framework approaches HTML-injection so I made a quick test:

http://example.com/hello/<u>café

... which showed up like this:

Hello, %3Cu%3Ecaf%C3%A9!

In other words, route parameters are not URL-decoded when they reach my function. Other frameworks I've tried decode everything for you, just as if you were reading from $_GET.

Is there an issue with my set-up (Apache/2.4, mod_php and mod_rewrite with the default .htaccess bundled with the framework) or that's the expected input?

  • 写回答

1条回答 默认 最新

  • doukuipei9938 2015-09-03 10:25
    关注

    It's an intentional bug/feature (see Route parameters are URL-encoded #238 for reference). No idea about the rationale behind the design decision.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?