使用 Mojolicious::Lite (perl) - 我想将所有参数的列表放入一个简单的@ARRAY
use Mojolicious::Lite (perl) - I want to get a list of all PARAMS into a simple @ARRAY
https:///getparam?h1=你好&h2=再见
get 'getparam' => sub {
my $c = shift;
print $c->param('h1') . "\n"; # THIS WORKS AS I WOULD EXPECT
my @list_of_all_params = $c->param; # DOES NOT WORK and THIS IS WHAT I WOULD LIKE TO MAKE WORK
return 1;
};
所以我真正想要的是@list_of_all_params包含传递的参数“h1”和“h2”
使用:https:///getparam?h1=hello&h2=goodbye
提前谢谢大家!
也许
# Dump the query as a hash
warn Data::Dumper->new([$c->req()->params()->to_hash()],[qw(*text)])->Dump(),' ';
# Dump the names in the query
warn Data::Dumper->Dump([$c->req()->params()->names],[qw(*params)]),' ';
# Dump the values for each key of the query
for my $key (@{$c->req()->params()->names}) {
warn Data::Dumper->new([$key,$c->req()->every_param($key)],[qw(*key *values)])->Dump(),' ';
};
https://
get 'getparam' => sub {
my $c = shift;
print $c->param('h1') . "\n"; # THIS WORKS AS I WOULD EXPECT
my @list_of_all_params = $c->param; # DOES NOT WORK and THIS IS WHAT I WOULD LIKE TO MAKE WORK
return 1;
};
所以我真正想要的是@list_of_all_params包含传递的参数“h1”和“h2”
使用:https://
提前谢谢大家!
也许
# Dump the query as a hash
warn Data::Dumper->new([$c->req()->params()->to_hash()],[qw(*text)])->Dump(),' ';
# Dump the names in the query
warn Data::Dumper->Dump([$c->req()->params()->names],[qw(*params)]),' ';
# Dump the values for each key of the query
for my $key (@{$c->req()->params()->names}) {
warn Data::Dumper->new([$key,$c->req()->every_param($key)],[qw(*key *values)])->Dump(),' ';
};