亲爱的StackOverflow社区,
我对Composer来说真的很新,所以解决方案可能很简单,但我不明白。
我的PHP文件看起来像这样
<html>
<head>
<title>ServerStatusChecker</title>
<link rel="icon" href="favicon.ico">
</head>
<body>
<?php
echo "1";
require '/vendor/autoload.php';
echo "2";
use MinecraftServerStatus\MinecraftServerStatus;
echo "3";
$response = MinecraftServerStatus::query('mineplex.com', 25565);
echo "4";
if (! $response) {
echo "The Server is offline!";
} else {
echo "<img width=\"64\" height=\"64\" src=\"" . $response['favicon'] . "\" /> <br>
The Server " . $response['hostname'] . " is running on " . $response['version'] . " and is online,
currently are " . $response['players'] . " players online
of a maximum of " . $response['max_players'] . ". The motd of the server is '" . $response['description'] . "'.
The server has a ping of " . $response['ping'] . " milliseconds.";
}
?>
</body>
</html>
所以我的问题是,当我调用网页时,除了一个调试1
之外,它仍然是空白的。
我没有收到任何可见的错误消息或类似信息。 那么为什么会发生这种情况和/或我做错了什么?
亲切的问候
答案 0 :(得分:1)
将第10行require '/vendor/autoload.php';
更改为require './vendor/autoload.php';
并且有效
感谢@AammadUllah