Mojolicious every_param没有为整数填充数组

时间:2017-05-31 14:42:45

标签: perl parameters mojolicious

  my $warranty_dates  = $self->every_param('warranty_date');
  my $state_ids       = $self->every_param('state_id');

结果:

   $VAR1 = undef;

  $VAR1 = '12/12/2017';
  $VAR2 = '12/12/2017';
  $VAR3 = '12/12/2017';
  $VAR4 = '12/12/2017';
  $VAR5 = '12/12/2017';
分别在

调用时

  die Dumper(@{$state_ids});

  die Dumper(@{$warranty_dates});

尽管显示具有以下参数:

  "state_id" => [
    1,
    1,
    1,
    1,
    1
   ],
  "warranty_date" => [
    "12/12/2017",
    "12/12/2017",
    "12/12/2017",
    "12/12/2017",
    "12/12/2017"

1 个答案:

答案 0 :(得分:0)

所以我找到了答案,即我没有将这些参数作为发布请求来解决。

https://corky.net/dotan/programming/mojolicious-request-parameters-example.html

快速解释为什么其中一些参数需要采用格式

$self->req->every_param('');

Passing arguments to redirect_to in mojolicious and using them in the target controller