修改mod_perl2中的POST请求

发布于 2024-09-06 13:51:48 字数 206 浏览 1 评论 0原文

有谁知道如何使用 mod_perl2 访问/修改 POST 请求数据。 在 GET 方法中可以获取/设置请求 QUERY 字符串:

  $args      = $r->args();
  $prev_args = $r->args($new_args);

如何在 POST 方法中获取/设置请求 QUERY 字符串?

Does anyone know how to access/modify the POST request data using mod_perl2.
IN GET method one can get/set the request QUERY string:

  $args      = $r->args();
  $prev_args = $r->args($new_args);

How to get/set the request QUERY string in POST method ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一笑百媚生 2024-09-13 13:51:48

使用 Apache2::Request::param 获取 POST 参数。

要进行设置,首先从 body 方法。将bless它转换为APR::Table 对象,然后使用其方法来操作数据。

Get POST parameters with Apache2::Request::param.

To set, first get an APR::Request::Param::Table object from the body method. Rebless it into an APR::Table object, then use its methods to manipulate the data.

仙女 2024-09-13 13:51:48

我使用此 mod_perl2 代码片段成功解析通过 POST 方法提交的表单字段值:

use CGI;

my $req = CGI->new($r);
my $field_value = $req->param('form_field');

如果您不使用 CGI; 如上所示,而是使用以下代码:

my $req = Apache2::Request->new($r);
my $field_value = $req->param('form_field');

您可能会GET 方法成功。然而,在通过 POST 方法获取请求时,就我而言,我陷入了“预取 filter.c(270) 错误”的无限循环,并且请求将永远不会返回。

I use this mod_perl2 code snippet to successfully parse out a form's field value submitted via POST method:

use CGI;

my $req = CGI->new($r);
my $field_value = $req->param('form_field');

If you don't use CGI; as illustrated above, and instead, use the following code:

my $req = Apache2::Request->new($r);
my $field_value = $req->param('form_field');

You'll probably succeed in GET method. However, while getting request via POST method, in my case, I got into infinite loop of some king of 'prefetching filter.c(270) error' and the request will never return.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文