// +---------------------------------------------------------------------- use think\facade\Route; Route::get('think', function () { return 'hello,ThinkPHP6!'; }); Route::get('hello/:name', 'index/hello'); Route::post('log/report', function () { $data = request()->post(); \app\utils\Logger::error(\app\utils\Logger::CAT_FRONTEND, $data['message'] ?? 'unknown', [ 'source' => $data['source'] ?? 'unknown', 'type' => $data['type'] ?? 'error', 'stack' => isset($data['stack']) ? substr($data['stack'], 0, 2000) : '', 'file' => $data['file'] ?? '', 'url' => $data['url'] ?? '', 'line' => $data['line'] ?? '', 'col' => $data['col'] ?? '', 'ua' => request()->header('user-agent', ''), 'ip' => request()->ip(), ]); return json(['status' => 1]); });