rtc_rooms_kickUser.php 750 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require_once __DIR__ . '/../../autoload.php';
  3. use Qiniu\Auth;
  4. use Qiniu\Rtc\AppClient;
  5. // 控制台获取密钥:https://portal.qiniu.com/user/key
  6. $accessKey = getenv('QINIU_ACCESS_KEY');
  7. $secretKey = getenv('QINIU_SECRET_KEY');
  8. $auth = new Auth($accessKey, $secretKey);
  9. $client = new AppClient($auth);
  10. // app 的唯一标识,创建的时候由系统生成
  11. $appId = 'xxxx';
  12. // 房间名称
  13. $roomName = 'room01';
  14. // 操作所剔除的用户
  15. $userId = '001';
  16. // 指定一个用户踢出房间
  17. // 参考文档:https://doc.qnsdk.com/rtn/docs/server_overview#2_2
  18. list($ret, $err) = $client->kickUser($appId, $roomName, $userId);
  19. if ($err !== null) {
  20. var_dump($err);
  21. } else {
  22. echo "\n====> Kick User $userId Successfully \n";
  23. }