lumen laravel response对象返回数据

Route::get('home', function () {
    $content = "内容";
    $status = 301;
    $value = 'text/html';
//    return (new Response($content, $status))
//        ->header('Content-Type', $value);

//    return response($content, $status)
//        ->header('Content-Type', $value);


//    return response($content)
//        ->header('Content-Type', $value)
//        ->header('X-Header-One', 'Header Value')
//        ->header('X-Header-Two', 'Header Value');


//    return response($content)
//        ->withHeaders([
//            'Content-Type' => $value,
//            'X-Header-One' => 'Header Value',
//            'X-Header-Two' => 'Header Value',
//        ]);

    //return response()->json(['name' => 'Abigail', 'state' => 'CA']);



});

  

https://learnku.com/docs/lumen/5.3/responses/1884

原文地址:https://www.cnblogs.com/php-linux/p/12713737.html