php异步

require_once "./class/runtime.class.php";

$run_time = new runtime();  
$run_time->start();
asyn_sendmsg();

$run_time->stop();  
echo "asyn server running time:".$run_time->spent()."ms";

function asyn_sendmsg() {
    $fp=fsockopen('xxx.com.cn',80,&$errno,&$errstr,5);
    if(!$fp){
        echo "$errstr ($errno)<br />\n";
    }
    sleep(1);
    fputs($fp,"GET http://xxxxx/wx_send.php?debug=true\n"); #请求的资源 URL
    fclose($fp);
}

你可能感兴趣的:(php异步)