1.选择图片&上传
2.图片链接
名称 大小 状态 链接

this is about

404 NOT FOUND
1, "msg" => "uri错误", "data" => [] ]); call_user_func($func); } } function echo_json($data) { header('Content-Type: application/json; charset=utf-8'); echo json_encode($data, JSON_UNESCAPED_UNICODE); die; } function api_test() { echo_json([ "code" => 0, "msg" => "test", "data" => [] ]); } function api_upload() { $web = "https://demo.winxg.com"; $url = "https://telegra.ph/upload"; $filePath = $_FILES["file"]["tmp_name"]; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, array( 'file' => new CURLFile($filePath) )); $response = curl_exec($ch); curl_close($ch); $jsonArr = json_decode($response, true); $src = $jsonArr[0]["src"] ?? ""; $uuid = uniqid(); $db = new SQLite3(DATA_PATH . 'data.db'); $db->exec("INSERT INTO files (uuid, src) VALUES ('{$uuid}', '{$src}')"); $db->close(); echo_json([ "code" => empty($src) ? 1 : 0, "msg" => "", "data" => [ "id" => $_POST["id"], "src" => $web . "/file/{$uuid}" ] ]); } // api func end ?> exec('CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, uuid TEXT, src TEXT)'); $db->close(); empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == "/" && $_SERVER['REQUEST_URI'] = "/index"; check_api(); if (str_starts_with($_SERVER['REQUEST_URI'], "/file")) { $id = explode("/", $_SERVER['REQUEST_URI'])[2] ?? ""; $results = $db->query("SELECT * FROM files WHERE uuid='{$id}' LIMIT 1"); $row = $results->fetchArray(); $db->close(); var_dump($row['src']); die; } } function get_page_title() { $uri = $_SERVER['REQUEST_URI']; $pages = json_decode(file_get_contents(CONFIG_PATH . "page.json"), true); return $pages[$uri]["title"] ?? "404 NOT FOUND"; } function show_page() { $uri = $_SERVER["REQUEST_URI"]; $func = ltrim(implode("_", explode("/", $uri)), "_"); if (function_exists("show_{$func}")) { call_user_func("show_{$func}"); } else { call_user_func("show_404"); } } // common func end ?>