laravel RouteCollection.php 第 179 行中的 1/1 NotFoundHttpException:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44437208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 16:06:20  来源:igfitidea点击:

1/1 NotFoundHttpException in RouteCollection.php line 179:

phplaravellaravel-5

提问by Black tom

Router file

路由器文件

Route::get('index',[
        'as'=>'home',
        'uses'=>'PageController@getIndex'
]);

P age Controller

页面控制器

namespace App\Http\Controllers;
use Illuminate\Http\Request;
class `PageController` extends Controller
{
    public function getIndex(){
        return view('master');
    }
}

please help me,i tried but there was a problem :NotFoundHttpException in RouteCollection.php line 179: thank so much

请帮帮我,我试过了,但有一个问题:RouteCollection.php 第 179 行中的 NotFoundHttpException:非常感谢

回答by utdev

return view('master');returns to the folder named master. Inside that master folder you have to create a blade file, for instance this index.blade.php.

return view('master');返回到名为 master 的文件夹。在该主文件夹中,您必须创建一个刀片文件,例如 index.blade.php。

Afterwards you do this in your Controller:

之后,您在控制器中执行此操作:

return view('master.index');

That will link to resources/views/master/index.blade.php

这将链接到 resources/views/master/index.blade.php

回答by ukalpa

Just a kind reminder another possible reason causes the issue is that you should put your Route::get(..) into "web.php" not other php files like "api.php" in the routes folder.

提醒一下,导致此问题的另一个可能原因是您应该将 Route::get(..) 放入“web.php”,而不是将其他 php 文件(如“api.php”)放入路由文件夹中。

回答by YouniQue Business

Login to Cpanel: locate MultiPHP INI Editor change the desired domain to php7 or above the same page make sure these settings are correct as follows: allow_url_fopen, allow_url_include both enabled display_errors enable_dl disabled Rest is up to your own preference. Then click save.

登录Cpanel:找到MultiPHP INI Editor 将所需的域更改为php7 或同一页面以上 确保这些设置正确如下: allow_url_fopen, allow_url_include both enabled display_errors enable_dl disabled 其余取决于您自己的喜好。然后点击保存。

Now edit your .env file as follows:

现在编辑您的 .env 文件,如下所示:

APP_NAME=Laravel 
APP_ENV=local 
APP_KEY=base64:#######################= 
APP_DEBUG=true 
APP_LOG_LEVEL=false 
APP_URL=https://yourdomain.com
MAIL_DRIVER=sendmail MAIL_HOST=smtp.googlemail.com 
MAIL_PORT=587 
[email protected] 
MAIL_PASSWORD=password 
MAIL_ENCRYPTION=null

Finally, empty your cache and try again. Note that 404 pages will not display unless you create one.

最后,清空缓存并重试。请注意,除非您创建一个,否则不会显示 404 页。