Answer the question
In order to leave comments, you need to log in
How can I make php not wait for the previous thread to finish?
There is a page:
echo 'Start: '.date('c');
echo '<br/>';
sleep(5);
echo 'End: '.date('c');
Answer the question
In order to leave comments, you need to log in
The problem was in xdebug. Everything is fine without him.
I set it up like this:
https://habrahabr.ru/post/250323/
Well, in chrome, you need to set the "Disable cache" flag using DevTools
You may have php sessions there. session_write_close will help
. UPD: If you use the built-in PHP server , then no way. It processes only one request at a time.
You seem to be using PHP's built-in web server. It works in 1 thread. Therefore, blocking it through sleep () other requests are waiting.
This will help you, but will only work with Nginx + PHP-FPM.
// здесь весь вывод клиенту
session_write_close ();
fastcgi_finish_request();
// здесь делать долгую работу (отправлять письмо или другое)
Try to integrate this python script into your C++
import requests
class API:
API_URL = 'https://api.vk.com/method/'
def __init___(self, image_path, access_token):
self.img = image_path
self.token = access_token
def send(self):
response = requests.post(self.API_URL + 'photos.getMessagesUploadServer', params={'access_token': self.token}).json()
req = requests.post(response['upload_url'], params={'access_token': self.token}, files={'file': open(self.img, 'rb')}).json()
req.update({'access_token': self.token})
req = requests.post(self.API_URL + 'photos.saveMessagesPhoto', params=req)
return req.json()
# Usage :
# api = API('img.jpeg', 'XXX')
# response = api.send()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question