【问题标题】:Laravel HTTP status code "1" is not valid errorLaravel HTTP 状态码“1”无效错误
【发布时间】:2019-01-09 15:10:19
【问题描述】:

我正在尝试访问我的网址:http://localhost/app/public/questions/1

我的路线

 $this->get('/questions/{question_id}','questionController@show');

我的控制器

public function show($question_id) {

    $showQuestion=questions::findOrFail($question_id);
    return redirect('questions',compact('showQuestion'));
}

由于某种原因,我收到此错误

InvalidArgumentException in Response.php line 458:
The HTTP status code "1" is not valid.

可能是什么问题?

【问题讨论】:

    标签: php laravel laravel-5 laravel-5.2


    【解决方案1】:

    我猜你正在尝试返回一个视图

    public function show($question_id) {
    
        $showQuestion=questions::findOrFail($question_id);
        return view('questions')->with('question', $showQuestion);
    }
    

    Source

    【讨论】:

      【解决方案2】:

      在我自己有类似的东西之后,也许你应该使用:

      return redirect('questions')->with('showQuestion', $showQuestion);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-02-23
        • 2019-05-18
        • 2017-04-18
        • 2010-11-24
        • 2021-01-02
        • 2015-08-29
        相关资源
        最近更新 更多