📜  流明中的 session() - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:00.157000             🧑  作者: Mango

代码示例1
// Save Session
$router->get('/', function (\Illuminate\Http\Request $request) {

    $request->session()->put('name', 'Lumen-Session');

    return response()->json([
        'session.name' => $request->session()->get('name')
    ]);
});


// Test session
$router->get('/session', function (\Illuminate\Http\Request $request) {

    return response()->json([
        'session.name' => $request->session()->get('name'),
    ]);
});