繁体   English   中英

有什么方法可以将屏幕内容打印到网页上?

[英]Any way to print contents of a screen to a web page?

我正在屏幕上运行minecraft服务器(屏幕-X mc java -jar minecraft_server.jar)。 有什么方法可以将其内容打印到网页上吗? 我当时想这可能与

<?php
$console = exec(console.sh)
echo $console;
header("refresh: 5";);
?>

但是,这不会打印任何内容。 我认为这与每个用户的屏幕有关,有什么方法可以让php运行吗? 还是有将屏幕输出到文件并仍然可以附加到屏幕的方法?

万分感谢!

编辑:下面的答案很好,但是我建议使用http://phpshell.sourceforge.net 您可以登录终端并显示控制台以及可以聊天。 但是,这是交互式的,并且仅适用于管理员。

这些都应该起作用。

<?php
$logs = "PATH_TO_SERVER_LOGS/server.log";
$fh = fopen($logs, 'r');
$theData = fread($fh, filesize($logs));
fclose($fh);
echo $theData;
header("refresh: 5");
?>

<?php
//Replace ./server.log with the path to your server logs and make sure apache has the proper //permissions to read the file.
$file = file_get_contents('./server.log', true);
echo $file;
header("refresh: 5");
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM