gpt4 book ai didi

laravel - 如何修复此错误 : NotFoundHttpException in Controller. php?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:42:56 26 4
gpt4 key购买 nike

我收到此错误消息:

Controller.php 第 269 行中的 NotFoundHttpException:找不到 Controller 方法。

谁能帮我解决这个错误信息?这是与错误消息相关的所有代码:

HomeController.php

public function postSeo(Request $request)
{



$data = array('meta_title' => $request->get('meta_title'),
'meta_keyword' => $request->get('meta_keyword'),
'meta_description' => $request->get('meta_description')
);


DB::table('meta')->where('meta_id', '1')
->update($data);

return redirect('/home/article');

}

路由.php

 Route::post('/home/article', [
'uses' => 'HomeController@postSeo'
]);

文章.blade.php

 <label>SEO</label><br><br>

<table width="350px">
<form action="{{ action('HomeController@postSeo')}}" method="post">
{{ csrf_field() }}

<tr>
<td>Meta Title</td>
<td><input type="text" value="" name="meta_title"></td>
</tr>
<tr>
<td>Meta Keyword</td>
<td><input type="text" value="" name="meta_keyword"></td>
</tr>
<tr>
<td>Meta Description</td>
<td><input type="text" value="" name="meta_description"></td>
</tr>
<tr>
<td><br><br><input type="submit" value="update"></td>
<td></td>
</tr>

</form>
</table>

最佳答案

更新后,您将重定向到 /home/article,这是一个获取路径。看起来你还没有定义这条路线。您需要添加此路由或重定向到其他地方。

Route::post('/home/article', 'HomeController@postSeo');
Route::get('/home/article', 'HomeController@showSeo');

如果您不需要为此获取路由,请找到合适的页面进行重定向。

关于laravel - 如何修复此错误 : NotFoundHttpException in Controller. php?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44042451/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com