In PHP, you can set "CUROPT_TIMEOUT" to 1 when using CURL to trigger PHP curl without waiting for return.
Recommendation: "PHP Video Tutorial"
php curl
method to trigger a script without waiting for returnIf you want PHP to access a URL, but do not need to return a result, such as a page that needs to be executed for a long time, you do not need to wait for the return result, you only need to execute it. One of the methods:
Use CURL needs to set CUROPT_TIMEOUT to 1 (minimum is 1). That is, the client must wait at least 1 second.
public function set_cache_log(){ $host = "https://****.com.cn/index.php?s=/moudle/controller/function/id/12"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 1); $content=curl_exec($ch); curl_close($ch); }
The above is the detailed content of php curl implementation method without waiting for return. For more information, please follow other related articles on the PHP Chinese website!