加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

在Perl催化剂中通过URL传递参数

发布时间:2020-12-16 06:15:42 所属栏目:大数据 来源:网络整理
导读:是否可以通过perl催化剂中的URL传递参数 我有一个链接 a href="/vbo/mortgage_reduction/yearly" Yearly /a 我可以通过链接传递参数,例如 a href="/vbo/mortgage_reduction/yearly/1" Yearly/a 如果是这样,我如何获取模块中的值? 解决方法 我自己刚刚开始学
是否可以通过perl催化剂中的URL传递参数
我有一个链接

<a href="/vbo/mortgage_reduction/yearly" >Yearly </a>

我可以通过链接传递参数,例如

<a href="/vbo/mortgage_reduction/yearly/1" >Yearly</a>

如果是这样,我如何获取模块中的值?

解决方法

我自己刚刚开始学习Catalyst,但我可以说这似乎是什么:Args是为了.您可以指定所需的参数数量,并将它们添加到@_.我做了这个测试:

sub test :Local :Args(1) {
    my ( $self,$c,$word ) = @_;
    $c->response->body($word);
}

并加载http:// localhost:3000 / test / hello.这在浏览器和服务器输出中显示“hello”:

[info] *** Request 1 (0.083/s) [14444] [Thu Jun  5 11:29:18 2014] ***
[debug] Path is "test"
[debug] Arguments are "hello"
[debug] "GET" request for "test/hello" from "127.0.0.1"
[debug] Response Code: 200; Content-Type: text/html; charset=utf-8; Content-Length: unknown
[info] Request took 0.00722s (138.504/s)
.------------------------------------------------------------+-----------.
| Action                                                     | Time      |
+------------------------------------------------------------+-----------+
| /test                                                      | 0.000194s |
| /end                                                       | 0.000265s |
'------------------------------------------------------------+-----------'

这在Action types.下的Catalyst :: Manual :: Intro中有记录

一系列控制器方法也可以检查相同的请求,每个请求带有一定数量的“URL参数”,其中包括:CaptureArgs和action chains.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读