简体   繁体   English

我怎样才能获得原始发布数据并使用Apache2 :: Request来访问参数?

[英]How can I both get raw post data and use Apache2::Request to access parameters?

Apache2::Request doesn't seem to provide a way to get the raw post data; Apache2 :: Request似乎没有提供获取原始发布数据的方法; is there one that I am missing? 有一个我失踪的?

Alternatively, is there a way to read the post data separately (in a content handler - nothing should have messed with the post data before then) and initialize Apache2::Request with it? 或者,有没有办法分别读取帖子数据(在内容处理程序中 - 之前没有任何东西应该与帖子数据混淆)并用它初始化Apache2 :: Request?

from mod_perl cookbook: 来自mod_perl食谱:

my $r = shift;

my $content;
$r->read($content,$r->header_in('Content-length'));

my @pairs = split(/[&;]/,$content);

foreach my $pair (@pairs) {
    my ($parameter,$value) = split('=',$pair,2);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM