只有" /"路线正在我的Laravel应用程序中工作

时间:2015-06-03 14:33:49

标签: php apache laravel routes laravel-5

这是我的路线:

    Route::get('/', 'WelcomeController@index');

    Route::get('home', 'WelcomeController@index');

    Route::controllers([
        'auth' => 'Auth\AuthController',
        'password' => 'Auth\PasswordController',
    ]);

这是我的WelcomeController:

   <?php namespace App\Http\Controllers;

   class WelcomeController extends Controller {

    /*
    |--------------------------------------------------------------------------
    | Welcome Controller
    |--------------------------------------------------------------------------
    |
    | This controller renders the "marketing page" for the application and
    | is configured to only allow guests. Like most of the other sample
    | controllers, you are free to modify or remove it as you desire.
    |
    */

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Show the application welcome screen to the user.
     *
     * @return Response
     */
    public function index()
    {
        return view('welcome');
    }

  }

视图很简单..

我把/ home的结果是这样的:

enter image description here

为什么我做错了?

使用Apache / xampp的东西?我只是不知道..我在主文件夹中再次安装了作曲家,没有任何改变。

所以,如果有人能帮助我,我会很高兴

1 个答案:

答案 0 :(得分:0)

您在浏览器中访问的网址不正确。从屏幕截图中,它显示您已转到web-service/public/home。您在浏览器中输入的网址应为:

web-service/public/index.php/home

或者,如果您启用了漂亮的网址(已启用网址重写),您可以转到:

web-service/home