【发布时间】:2018-07-29 09:06:22
【问题描述】:
我注意到我的一些帖子没有提交,所以我在 c++ 代码中看到了 curl 的输出,它给出了
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>413 Request Entity Too Large</title>
</head><body>
<h1>Request Entity Too Large</h1>
The requested resource<br />/receiver.php<br />
does not allow request data with POST requests, or the amount of data provided in
the request exceeds the capacity limit.
</body></html>
我用这个测试了 php 端发布请求的最大大小:
echo ini_get('post_max_size');
我得到了:20M
然后得到从 c++ 代码发送的帖子的大小,如下所示:
void send_request(string url, string field,string data) {
string post_req = field + "=" + data;
CURL *curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_req.c_str());
cout << "post size : " << post_req.size() << endl;
curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
帖子只有 1059544 字节 = 1M 距离20M还很远
php 方面的问题在哪里?还是c++代码?
【问题讨论】:
-
为什么投反对票?
-
您使用的是哪个网络服务器?它的请求大小限制是多少?你的php代码在哪里?我们需要一个minimal reproducible example
-
正如我所说,我在 php 端打印了 post_max_size 值,它给了我 20M,我的 php 是免费的奖励空间托管。我搜索了他们的请求大小限制,但没有找到任何东西,我可能会联系支持,因为 php 结果可能是错误的
-
post_max_size是 php 将接受的最大 post 请求大小,如果不是更多,您的应用程序和 php 之间将至少有一个 Web 服务器,这将有自己的规则 -
我现在提交了一张票,等待他们的回复,我认为你是对的,我必须购买一个付费帐户