你好,問題如標(biāo)題,代碼是:
$worker->onMessage = function($connection, $data)
{
//var_dump($_GET, $_POST);
// send 時(shí)會自動(dòng)調(diào)用$connection->protocol::encode(),打包數(shù)據(jù)后再發(fā)送
//$connection->send("hello");
//error_log($data."\r\n",3,'/tmp/socket2.log');
//post_data($data);
$post_data = array();
$post_data = $data;
error_log($data."\r\n",3,'/tmp/socket2.log');
$url='http://wap.we2life.com/base/charging/heart';
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_exec($ch);
foreach($connection->worker->connections as $con)
{
$con->send($data);
}
};
// 運(yùn)行worker
Worker::runAll();