【发布时间】:2016-11-04 22:46:33
【问题描述】:
尊敬的 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。
我没有收到任何可见的错误消息或类似消息。 那么为什么会发生这种情况和/或我做错了什么?
亲切的问候
【问题讨论】:
-
你的目录结构是什么?作曲家安装完成没有错误?
-
通过命令行运行composer并安装包,它会让你的生活变得轻松
-
@JakubJudas 我的 index.php 文件与 'composer.json' 和 'vendor 文件夹' 一起位于 '/var/www/html/ServerChecker' 中。它安装时没有明显错误
-
@AammadUllah 我已经通过命令行安装了包
-
只需打开命令并移动到要安装包的目录并输入 composer require package name 并回车。
标签: php composer-php require