Skip to content

读取文件内容(用于在线编辑)

读取或保存文件内容,用于面板在线编辑器。

POST
https://your-panel.example.com:8888/files
更新于 查看 Markdown

Request bodyX-WWW-FORM-URLENCODEDrequired

  • request_timestringrequired

    Unix 时间戳。

  • request_tokenstringrequired

    按 API 概览生成的签名。

Returns

default

接口响应,业务状态见下方详细说明。

JSON
  • statusoptionalboolean

    true

  • dataoptionalstring

    文件内容

  • encodingoptionalstring

    检测到的编码(如 utf-8)

  • sizeoptionalinteger

    文件大小(字节)

  • only_readoptionalboolean

    是否只读

各操作详细说明

GetFileBody读取文件内容(用于在线编辑)

GetFileBody / SaveFileBody

读取或保存文件内容,用于面板在线编辑器。

  • 路由:POST /files

GetFileBody

读取文件内容,自动检测编码。

参数名称 必选 类型 描述
action 是 String GetFileBody
path 是 String 文件路径

输出参数

参数名称 类型 描述
status Boolean true
data String 文件内容
encoding String 检测到的编码(如 utf-8)
size Integer 文件大小(字节)
only_read Boolean 是否只读

示例

{"status": true, "only_read": false, "size": 917, "encoding": "utf-8", "data": "<!doctype html>..."}

SaveFileBody

保存编辑后的内容到文件。

参数名称 必选 类型 描述
action 是 String SaveFileBody
path 是 String 文件路径(必须已存在)
data 是 String 新内容
encoding 是 String 编码,如 utf-8

文件必须已存在且面板有写入权限。

Navigation

Type to search…

↑↓ navigate↵ selectEsc close