沃梦达 / 编程问答 / php问题 / 正文

Laravel 5.1 找不到路由对象

Laravel 5.1 Route Object not found(Laravel 5.1 找不到路由对象)

本文介绍了Laravel 5.1 找不到路由对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我,我正在使用最新版本的 xampp &不知道我的问题是什么原因.

Please help me, I'm working on a Laravel using the latest version of xampp & do not know what the cause of my problem is.

这条路线运行良好:

Route::get('/', function () {
    return 'aa';
});

这条路线给出一个错误找不到对象!":

This route gives an error "Object not found!":

Route::get('about', function () {
    return 'aaa';
});

httpd.vhosts:

httpd.vhosts:

<VirtualHost test.loc:80>
   DocumentRoot "C:/xampp/apps/test.loc/public"
   ServerName test.loc
   <Directory "C:/xampp/apps/test.loc/public">
            #AllowOverride All - when I use this, I get a "Access forbidden!" for all routes
        Require all granted - this works for the main route, other routes give "errors".
</Directory>

/public/.htaccess:

/public/.htaccess:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

推荐答案

我遇到了完全相同的问题,但最后这对我有用.

I faced exactly the same problem, but finally this worked for me.

.....
<Directory "C:/xampp/apps/test.loc/public">
   Options Indexes FollowSymLinks Includes ExecCGI
   AllowOverride All
   Require all granted
</Directory>

这篇关于Laravel 5.1 找不到路由对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Laravel 5.1 找不到路由对象

基础教程推荐