How can i stop a server sent event script from running when the user closes the page? PHP
问题 Im trying to use SSE in PHP backend to send messages to a user. the functional part of the backend code looks like- <?php set_time_limit(0); header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); ignore_user_abort(0); @session_start(); ob_start(); echo "retry: 1000\n"; ob_flush(); flush(); require_once 'sql_connection_class.php'; require 'chatbox_class.php'; $chatbox=new chatboxclass($_GET['friendid']); function recursivesenddata(){ global $chatbox; $jsonobj=$chatbox-