【问题标题】:Mojolicious every_param not populating array for integersMojolicious every_param 不填充整数数组
【发布时间】:2017-05-31 14:42:44
【问题描述】:
  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"

【问题讨论】:

  • 你是怎么得到最后一个输出的?这看起来像您有错字,或者state_idparam 中有一些不可见的字符。也许是\0

标签: perl parameters mojolicious


【解决方案1】:

所以我找到了答案,那就是我没有将参数作为发布请求来处理。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-22
    • 1970-01-01
    • 2019-01-31
    • 2013-09-16
    • 1970-01-01
    • 1970-01-01
    • 2013-11-30
    相关资源
    最近更新 更多