为什么我的浏览器要等待?

Why is my browser to wait?

首先,感谢您看到我的post,我使用AJAX向服务器PHP发送请求(laravel),服务器将处理请求(大约 10 秒)在 return 之前 AJAX。但是,当 AJAX 请求等待时,我打开其他浏览器访问我的网页 -> 它仍然等待 10s。我不明白??? 我的js

function pullRequest() {
  /* send request to server */
  var xhr = $.ajax({
    method: 'POST',
    url: 'pull?random_key='+Math.floor(Math.random()*10),
    data: {'_token':$('meta[name=csrf-token]').attr('content')},
    success: function(response) {
      /* pull request */
      pullRequest();
    },
  }); /* end ajax */
  $('a[href]').click(function() {
    xhr.abort();
  });
} /* end function pullRequest */

$(function() {
  // pullRequest();
  setTimeout('pullRequest()', 2000);
});

我的php

public function handle(Request $request) {
  $time = time()+50;
  while(1) {
    echo connection_status();
    if($this->hasNewMessages() || time() >= $time) {
      break;
    }
    continue;
  }
  return $this->messages;
}

我已经录制了一段关于它的视频。对不起,因为我不知道插入它。请关注 link youtube:https://www.youtube.com/watch?v=8jqPU3R-60I

感谢阅读

使用命令 php artisan serve,您实际上是在启动 PHP 的内置 Web 服务器。

如 PHP 手册中所述:

Warning

This web server was designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server. It should not be used on a public network.

如果您想要生产级安装或任何其他功能,则需要使用单独的 Web 服务器,例如 Apache(您错误地使用了它)。