代码拉取完成,页面将自动刷新
同步操作将从 imoney/WopiHost 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
<?php
require 'vendor/autoload.php';
use Pux\Mux;
use Pux\Executor;
class FilesController {
public function getFileInfoAction($name) {
$path = "office/$name";
if (file_exists($path)) {
$handle = fopen($path, "r");
$size = filesize($path);
$contents = fread($handle, $size);
$SHA256 = base64_encode(hash('sha256', $contents, true));
$json = array(
'BaseFileName' => $name,
'OwnerId' => 'admin',
'Size' => $size,
'SHA256' => $SHA256,
'Version' => '222888822'
);
echo json_encode($json);
} else {
echo json_encode(array());
}
}
public function getFileAction($name) {
$path = "office/$name";
if (file_exists($path)) {
$handle = fopen($path, "r");
$contents = fread($handle, filesize($path));
header("Content-type: application/octet-stream");
echo $contents;
}
}
}
$mux = new Mux;
$mux->get('/files/:name', ['FilesController','getFileInfoAction']);
$mux->get('/files/:name/contents', ['FilesController','getFileAction']);
$path = $_SERVER['PATH_INFO'];
$args = explode("&", $path);
$route = $mux->dispatch( $args[0] );
Executor::execute($route);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。