duanpao4522 2017-11-07 17:43
浏览 33
已采纳

主页中的本地化

I want to add localization for first page. Used something like this in routes:

Route::get('/{lang?}', function ($lang = null) {
   App::setlocale($lang);
   return view('welcome');
});

it works. But the problem is when i want to go login page then it stays in same page. /login there thinks login is language. Is any idea how can i fix it?

  • 写回答

1条回答 默认 最新

  • dongyou2635 2017-11-07 18:14
    关注

    Put your login route before the one that sets the locale in the routing file. Router always matches the first route it finds, so /login will then match the login route, anything else that doesn't have a matching route will match that locale route.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?