简体   繁体   English

当我尝试重定向到laravel 5.6中的另一个页面时,出现类似“抱歉,找不到您要搜索的页面”的错误。

[英]when i am try to redirect to another page in laravel 5.6 then getting error like “Sorry, the page you are looking for could not be found.”

Thank In Advance for view my question 感谢提前查看我的问题

I am working on laravel 5.6 . 我正在研究laravel 5.6。 i am making condition with if statement 我用if语句做条件

like 喜欢

if($value == 5){
   return redirect('Mycon/Home');
}else{
//some thing
}

i am also use use Illuminate\\Support\\Facades\\Redirect; 我也使用Illuminate \\ Support \\ Facades \\ Redirect; on controller file. 在控制器文件上。 My condition work and also redirect to right url mean http://localhost/sample/test/Mycon/Home But After redirect url is right but error show like Sorry, the page you are looking for could not be found. 我的条件正常工作,并且也重定向到正确的URL,这意味着http:// localhost / sample / test / Mycon / Home。但是,重定向URL正确之后,却显示错误,如对不起,找不到您要查找的页面。

I am also add function in route file like Route::get('/Home', 'Mycon@Home'); 我也在路由文件中添加功能,如Route :: get('/ Home','Mycon @ Home');

If you registered the route: 如果您注册了路线:

Route::get('/Home', 'Mycon@Home');

You should redirect like this: 您应该这样重定向:

return redirect('Home');

First param is url, second is the action, if you want to do it by action you should redirect like this: 第一个参数是url,第二个参数是操作,如果要通过操作执行此操作,则应这样重定向:

return redirect()->action('Mycon@Home);

Your route is not the same as the redirect route: 您的路由与重定向路由不同:

if($value == 5){
   return redirect('Mycon/Home');
}else{
//some thing
}

Route should be something like : 路线应类似于:

Route::get('/Mycon/Home', 'Mycon@Home');

I will suggest the below example: 我将建议以下示例:

Route : 路线

Route::get('mycon/home', 'MyController@showHome')->name('home');

Redirect : 重定向

return redirect()->route('home');

Have fun :) 玩得开心 :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误“抱歉,找不到您要查找的页面。” Laravel 5.5 - Error "Sorry, the page you are looking for could not be found." Laravel 5.5 如何解决此错误,我收到“抱歉,找不到您要查找的页面。” - How do i fix this error i'm getting “Sorry, the page you are looking for could not be found.” 抱歉,找不到您要查找的页面。 Laravel 5.5 - Sorry the page you're looking could not be found. Laravel 5.5 抱歉,找不到您要查找的页面。 silex错误 - Sorry, the page you are looking for could not be found. silex error 当我用表格发布回复时,我得到“抱歉,找不到您要查找的页面。” - When I post a reply with a form i get “Sorry, the page you are looking for could not be found.” 提交表单后,我收到错误消息“抱歉,找不到您要查找的页面。” - After submitting a form i get an error “Sorry, the page you are looking for could not be found.” 抱歉,找不到您要寻找的页面Laravel 5.5 - Random Sorry, the page you are looking for could not be found Laravel 5.5 抱歉,找不到您要查找的页面-Laravel 5.2 - Sorry, the page you are looking for could not be found - Laravel 5.2 抱歉,找不到您要查找的页面。 RouteCollection.php第179行中的1/1 NotFoundHttpException: - Sorry, the page you are looking for could not be found. 1/1 NotFoundHttpException in RouteCollection.php line 179: 抱歉,您要寻找的页面-Laravel - Sorry, the page you are looking for - Laravel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM