我目前正在为Minecraft服务器编程控制面板,现在想知道如何读取位于远程服务器上的配置文件?
谢谢。
使用fopen()
从远程服务器读取:
fopen('http://www.google.com/', 'r');
有关更多详细信息,请查看PHP文档。从远程服务器读取文件的其他一些方法是file_get_contents()
和cURL。
我现在正在使用一个类(http://php.net/manual/de/function.ssh2-sftp.php)它实际上是在做我想要的一切
使用file_get_contents
$file = file_get_contents("path_to_file");
echo "<pre>";
print_r($file);