无法通过 ajax.get() 传递包含大文本块的变量
当我尝试通过 ajax.get() 传递大量变量并且其中一些变量包含很长的文本(~1000 个字符)时,PHP 似乎没有接收到任何变量。另一方面,当变量包含的文本少得多时,一切似乎都工作正常。
这是代码:
$.ajax({
type: "GET",
url: "../rate_insert.php",
async: true,
data: ({
"ftiaxto_save_input": ftiaxto_save_input,
"lektion_buch": lektion_buch,
.
. // lots of variables
.
"lektion_photo": lektion_photo,
"lektion_photo_thessi": lektion_photo_thessi
}),
success: function(data) {
alert("Data Loaded: " + data);
} // data
}); // .get
rate_insert.php 中的 Var_dump($_GET) 不返回任何内容。我的 php.ini 设置如下:
post_max_size = 80M
max_input_time -1
memory_limit = 128M
注意:没有 httpd 服务器,php 作为 CLI SAPI 运行。
When I try to pass a big number of variables through ajax.get() and some of them containt very long text (~1000 characters) PHP doesn't seem to receive any of them. On the other hand, when the variables contain much less text everything seems to be working fine.
This is the code:
$.ajax({
type: "GET",
url: "../rate_insert.php",
async: true,
data: ({
"ftiaxto_save_input": ftiaxto_save_input,
"lektion_buch": lektion_buch,
.
. // lots of variables
.
"lektion_photo": lektion_photo,
"lektion_photo_thessi": lektion_photo_thessi
}),
success: function(data) {
alert("Data Loaded: " + data);
} // data
}); // .get
Var_dump($_GET) in rate_insert.php does not return anything. My php.ini settings are as follows:
post_max_size = 80M
max_input_time -1
memory_limit = 128M
Note: there is no httpd server and php runs as CLI SAPI.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通过 GET 可以传递的数据量是有限制的。您应该使用 POST 来代替。
编辑 - 在这里查看限制 不同语言中 URL 的最大长度是多少浏览器?
There is a limit to how much data you can pass through GET. You should use POST instead.
EDIT - look here for limitations What is the maximum length of a URL in different browsers?
这是 GET 请求的限制。在这种情况下,您可能必须执行 POST。
This is a limitation of GET requests. In this case you might have to do a POST.
有关 GET 请求限制的更多信息: http://www.boutell.com/ newfaq/misc/urllength.html (感谢 Vinko Vrsalovic @ 是否有限制GET 请求的长度?)
Some more info about the limitations of GET requests: http://www.boutell.com/newfaq/misc/urllength.html (thanks to Vinko Vrsalovic @ Is there a limit to the length of a GET request?)