我刚刚在 app.mydomain.co 的开发服务器上放了一个练习 laravel 应用程序
我查看了文档,并像这样用子域组包装了路由
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::group(array('domain' => 'app.mydomain.co'), function()
{
Route::get('/', array('as'=>'home', 'uses'=>'QuestionController@getIndex'));
//Route::get('create', array('as'=>'create', 'uses'=>'UserController@getCreate'));
//Route::get('login', array('as'=>'login', 'uses'=>'UserController@getLogin'));
/*
Define RESTful Controllers
*/
Route::controller('user', 'UserController');
Route::controller('questions', 'QuestionController');
});
主页工作正常,但其余路线是 404 not found 错误,所以很明显我做错了什么,有什么想法吗?
这是 php artisan 路由的输出,其中域替换为 app
+--------------+--------------------------------------------------------+------+-------------------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------------+--------------------------------------------------------+------+-------------------------------------+----------------+---------------+
| qapp.app.co | GET /user/index/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController@getIndex | | |
| qapp.app.co | GET /user | | UserController@getIndex | | |
| qapp.app.co | GET /user/create/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController@getCreate | | |
| qapp.app.co | POST /user/store/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController@postStore | | |
| qapp.app.co | GET /user/login/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController@getLogin | | |
| qapp.app.co | POST /user/login/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController@postLogin | | |
| qapp.app.co | GET /user/logout/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController@getLogout | | |
| qapp.app.co | GET /user/{_missing} | | UserController@missingMethod | | |
| qapp.app.co | GET /questions/index/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController@getIndex | | |
| qapp.app.co | GET /questions | | QuestionController@getIndex | | |
| qapp.app.co | POST /questions/store/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController@postStore | | |
| qapp.app.co | GET /questions/show/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController@getShow | | |
| qapp.app.co | GET /questions/edit/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController@getEdit | | |
| qapp.app.co | PUT /questions/update/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController@putUpdate | | |
| qapp.app.co | GET /questions/your-questions/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController@getYourQuestions | | |
| qapp.app.co | GET /questions/{_missing} | | QuestionController@missingMethod | | |
| | GET / | home | QuestionController@getIndex
当我查看 apache 错误日志时,它似乎在 laravel 公共文件夹中查找与 php 查询相关的文件或目录,因此如果我尝试使用 url qapp.app.co/questions/ 访问问题控制器方法显示显示/14 错误是文件不存在:/var/www/app/public/questions