This commit is contained in:
2023-04-12 13:49:17 +08:00
parent 3a702821ed
commit 177aa840f0
+3 -2
View File
@@ -263,7 +263,7 @@ function api_upload()
$uuid = uniqid(); $uuid = uniqid();
$db = new SQLite3('data.db'); $db = new SQLite3(DATA_PATH . 'data.db');
$db->exec("INSERT INTO files (uuid, src) VALUES ('{$uuid}', '{$src}')"); $db->exec("INSERT INTO files (uuid, src) VALUES ('{$uuid}', '{$src}')");
$db->close(); $db->close();
@@ -285,7 +285,7 @@ function api_upload()
// common func start // common func start
function init() function init()
{ {
$db = new SQLite3('data.db'); $db = new SQLite3(DATA_PATH . 'data.db');
// 创建表 // 创建表
$db->exec('CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, uuid TEXT, src TEXT)'); $db->exec('CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, uuid TEXT, src TEXT)');
$db->close(); $db->close();
@@ -293,6 +293,7 @@ function init()
define("BASE_PATH", __DIR__ . "/../"); define("BASE_PATH", __DIR__ . "/../");
define("CONFIG_PATH", BASE_PATH . "/./config/"); define("CONFIG_PATH", BASE_PATH . "/./config/");
define("PUBLIC_PATH", BASE_PATH . "/./public/"); define("PUBLIC_PATH", BASE_PATH . "/./public/");
define("DATA_PATH", BASE_PATH . "/./data/");
empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == "/" && $_SERVER['REQUEST_URI'] = "/index"; empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == "/" && $_SERVER['REQUEST_URI'] = "/index";
check_api(); check_api();