老大,我在onClose时返回退出用户信息,打印数据正常,前端打印uid会变呢?是哪里有问题?
$close_user = '';
if(isset($connection->uid)){
$close_user = $worker->users[$connection->uid];
unset($worker->users[$connection->uid]); //册除退出用户
}
$send_nr = [
'type' => 'logout',
'users' => $worker->users,
'online' => count($worker->users),
'dq_user' => '',
'rsdata' => $close_user
];
foreach($worker->connections as $conn){
$conn->send(json_encode($send_nr));
}
var_dump($close_user);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…