当我尝试通过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运行。
答案 0 :(得分:5)
您可以通过GET传递多少数据。你应该使用POST。
编辑 - 请查看限制What is the maximum length of a URL in different browsers?
答案 1 :(得分:2)
这是GET请求的限制。在这种情况下,您可能需要进行POST。
答案 2 :(得分:0)
有关GET请求限制的更多信息:http://www.boutell.com/newfaq/misc/urllength.html(感谢Vinko Vrsalovic @ Is there a limit to the length of a GET request?)