我正在尝试在 URL 中传递参数
示例:
// client side
URL: index.pl?action=view_user
METHOD: GET
#perl side
my $Q = CGI->new;
print $Q->param('action');
返回我view_user
,但是当尝试在表单上通过示例发布时:
// client side
URL: index.pl?action=save_user
METHOD: POST
FORM:
username: test
#perl side
my $Q = CGI->new;
print $Q->param('action'), "-", $Q->param('username');
返回给我-test
。 为什么url上的参数为空?
最佳答案
处理 POST 请求时,使用 ->url_param
而不是 ->param
从 URL 获取参数。
关于perl - 在 POST 方法的 URL 中传递参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11909702/