PHP $ _GET麻烦
问题描述:
因此,我正在基于某种称为Hypixel API的网站上工作。
当我使用一个论坛,在这里,用户可以输入一个名字,我得到的
Player == nullArray ([0] => Array ([success] => [cause] => [status] => 204) [1] => Array ([success] => [cause] => [status] => 204))
这是一个反应是我的代码:
<?php
$ign = $_GET['ign'];
include_once('HypixelPHP.php');
$HypixelPHP = new HypixelPHP\HypixelPHP(['api_key' => 'BLOCKED']);
// get a player object using the hypixel api object
$player = $HypixelPHP->getPlayer([\HypixelPHP\KEYS::PLAYER_BY_NAME => '$ign']);
if ($player != null) {
echo 'View stats for ' . $player->getFormattedName(true, true);
echo '<br>';
echo '<h1>GAME STATS</h1>';
echo '<h3>Mega Walls</h3>';
echo 'Wins: ' . $player->getStats()->getGameFromID(\HypixelPHP\GameTypes::WALLS3)->getInt('wins');
echo '<br>';
echo 'Kills: ' . $player->getStats()->getGameFromID(\HypixelPHP\GameTypes::WALLS3)->getInt('kills');
echo '<br>';
echo 'Final Kills: ' . $player->getStats()->getGameFromID(\HypixelPHP\GameTypes::WALLS3)->getInt('final');
echo '<br>';
} else {
echo 'Player == null';
print_r($HypixelPHP->getUrlErrors());
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
</html>
在窗体中,我做了名事情正确。
这应该是输出:
随着一些其他的东西。
如果你们可以帮忙,谢谢!
你能提供文件HypixelPHP.php的内容吗?它在一个包含中被引用,并且它也有帮助。 –
@BrianSchroeter https://github.com/Plancke/hypixel-php点击HypixelPHP文件夹。 – HoogleyBoogley
你得到的是什么输出而不是你所期望的? – Barmar