any('/api')->to('API#'); $route->get('/get_data/:filename')->to('#su-6ren">
gpt4 book ai didi

api - Mojolicious API 忽略 URL 参数中 ". "之后的字符

转载 作者:行者123 更新时间:2023-12-04 13:06:53 25 4
gpt4 key购买 nike

我在我的代码中定义了以下路由:

my $route = $r->any('/api')->to('API#');
$route->get('/get_data/:filename')->to('#submit_forms');

如果我传递到 url 的文件名是“foo123456.bar_baz.bz2”,当我打印参数时,我得到:(例如 http://example.com/api/get_data/foo123456.bar_baz.bz2

print Dumper($c->param('filename'));
# foo123456

为什么它在经期后削减一切?

最佳答案

使用 #(或 *)代替 : 作为占位符:

$route->get('/get_data/#filename')->to('#submit_forms');

Mojolicious 有 3 种占位符:

引用宽松占位符的文档:

They can be especially useful for manually matching file names with extensions

关于api - Mojolicious API 忽略 URL 参数中 ". "之后的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69020991/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com