我有一个用 PHP 编写的teampeak3 机器人,当我启动机器人时出现此错误:PHP 警告:array_column() 期望参数 1 是数组,给定空值...在第 13 行,第 13 行是 $ clientonchannel,我不知道如何使它工作,感谢一些帮助。我是新手。PHP Code: $config['function']['pokeonchannel'] = Array( 'enable' => true, 'info' => Array( 1 => Array( 'channel' => 20, 'pokegroup' => Array(103,110), 'message' => "[NICK] message to user", ) ), 'interval' => Array('days' => 0, 'hours' => 0, 'minutes' => 0, 'seconds' => 30), //interval 'datazero' => '1970-01-01 00:00:00' ); foreach($config['function']['pokeonchannel']['info'] as $pokeid) { $admincount = 0; $admincount2 = 0; $clientonchannel = array_keys(array_column($user['data'], 'cid'), $pokeid['channel']); **// This is line 13** if(isset($clientonchannel[0])) { foreach($pokeid['pokegroup'] as $pokegroup) { $groupclients = $tsAdmin -> serverGroupClientList($pokegroup, $names = true); foreach($groupclients['data'] as $clientid) { $client = $tsAdmin -> clientFind($clientid['client_nickname']); if($client['data']) { $admin = $tsAdmin-> clientInfo($client['data'][0]['clid']); if(!in_array($admin['data']['cid'], $config['function']['helpchannel']['ignoredonchannel'])) { $pokemessage = str_replace('[NICK]', $user['data'][$clientonchannel[0]]['client_nickname'], $pokeid['message']); $tsAdmin -> clientPoke($client['data'][0]['clid'], $pokemessage); $admincount++;}
1 回答
HUH函数
TA贡献1836条经验 获得超4个赞
我认为变量 $user 不存在。您可以创建一个名为 $user 的变量并在其中获取详细信息。
$sql = "SELECT data FROM users where id = {user id}";
$user = $conn->query($sql);
- 1 回答
- 0 关注
- 136 浏览
添加回答
举报
0/150
提交
取消