Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中使用jquery的多帖子似乎失败了_Php_Jquery - Fatal编程技术网

在php中使用jquery的多帖子似乎失败了

在php中使用jquery的多帖子似乎失败了,php,jquery,Php,Jquery,我对我认为应该运行的代码有一个问题(实际代码运行,可能是设计问题)。用户将某些内容输入表单,表单必须以8种不同的方式进行处理。如果连续进行(包括互联网查询等),只会花费太长时间。因此,我的想法是捕获提交并启动8个并行操作,如下所示: if (process1==true) { $.post("dosomething.php",'w=1&i='+input',function(data) { (deal with return data, update scr

我对我认为应该运行的代码有一个问题(实际代码运行,可能是设计问题)。用户将某些内容输入表单,表单必须以8种不同的方式进行处理。如果连续进行(包括互联网查询等),只会花费太长时间。因此,我的想法是捕获提交并启动8个并行操作,如下所示:

if (process1==true) {
     $.post("dosomething.php",'w=1&i='+input',function(data) {
          (deal with return data, update screen)
     });
}
if (process2==true) {
     $.post("dosomething.php",'w=2&i='+input',function(data) {
          (deal with return data, update screen)
     });
}
if (process3==true) {
     $.post("dosomething.php",'w=3&i='+input',function(data) {
          (deal with return data, update screen)
     });
}
等等

很明显,这只是一个存根来演示正在发生的事情。但它捕获了post调用的处理方式(通过jQuery)

对dosomething.php的调用本身对另一台服务器进行套接字调用,该服务器使用分叉模型处理连接


大多数情况下,它都可以正常工作,但我经常会遇到诸如“读取错误”之类的错误。似乎正在踩下连接。只是不知道在哪里或如何。

第1期:您的
脚本包含
语法错误。混合单引号和双引号。
“dosomething.php”
在所有引用中混合使用了引号,并且是无与伦比的。注意语法突出显示?所有条件句都缺少大括号,或者每个条件句都有一个大括号。或者,这是经过深思熟虑的伪代码?请欣赏语法注释,但我只是发布了我为这个问题输入的伪代码。实际代码是无语法错误的,正如我所提到的,大部分时间都是有效的。这不是语法问题。代码的重点是显示方法。在(错误)日志中出现了什么?另外,你在检查错误吗?@Fred ii错误日志中没有任何内容。只有套接字处理代码如下所示:while(1){if(false===$chunk=socket\u read($socket,8192)){$this->error=-91;return-1;}if(strlen($chunk)==0)break;$this->results.=$chunk;}插座关闭($socket);--我读到了错误。请注意,如果我连续运行调用,则所有调用都可以正常工作。