简体   繁体   English

Laravel 5.4-路由不存在

[英]Laravel 5.4 - Route does not exist

I have a simple link on a page to a URL test: 我在页面上有一个指向URL测试的简单链接:

<a href="{{ URL('test')}}" title="test">

In web.php I have defined: 在web.php中,我定义了:

Route::get('test', function(){
    $parts = DB::table('partdetails')->limit(100);
    dd($parts);
    return view('test',compact($parts));
    })->name('test');

I also have a very basic view in the root directory of resources\\views call test.blade.php. 我在resources \\ views的根目录中也有一个非常基本的视图,调用test.blade.php。

When I try this I get 当我尝试这个我得到

The requested resource /test was not found on this server. 在此服务器上找不到请求的资源/测试。

I cannot get this! 我无法得到这个!

A few things come to mind.. 我想到了几件事。

  1. If you have a wildcard route, move it to the bottom of your routes file. 如果您有通配符路由,请将其移动到路由文件的底部。
  2. Make sure your .htaccess file is like the one coming with Laravel. 确保您的.htaccess文件类似于Laravel附带的文件。
  3. Make sure APP_URL in .env is correct 确保APP_URL中的APP_URL正确
  4. If you have Laravel installed in a sub-folder, you should search how to setup that correctly. 如果您在子文件夹中安装了Laravel,则应搜索如何正确进行设置。 There are tons of info on the web, easy to find. 网络上有大量信息,很容易找到。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM