【问题标题】:How to use stash when render file in command (mojolicious)在命令中渲染文件时如何使用存储(mojolicious)
【发布时间】:2021-09-02 11:58:22
【问题描述】:

我使用 Mojo::Template 在命令中渲染文件。我如何使用 stash(例如在控制器 $c->stash(value => 1) 中)。我知道我可以通过数组。但我需要使用储藏室。

my $mt = Mojo::Template->new; my $html = $mt->render_file( 'templates/some_file.html.ep', %$options ); 选项的数据格式错误。怎么做才对? 或者在命令中使用“render_to_string”可能是可以接受的?沉没

【问题讨论】:

    标签: templates render mojolicious


    【解决方案1】:
    my $c = $app->build_controller;
    $c->( 'templates/some_file.html.ep', %$options );
    

    【讨论】:

      猜你喜欢
      • 2014-05-11
      • 1970-01-01
      • 2017-06-26
      • 2018-06-13
      • 2015-10-06
      • 1970-01-01
      • 2016-05-02
      • 2017-10-26
      • 1970-01-01
      相关资源
      最近更新 更多