初学laravel 遇到的问题


因为web根目录中有其他的项目,就在根目录中建了一个laravel文件夹用来测试学习,访问 http://localhost/laravel/public 可以看到欢迎页。后来想去掉public,参考了这个网站 http://tutsnare.com/remove-public-from-url-laravel/ 的第二个方法,直接访问 http://localhost/laravel 就可以看到欢迎页了。在学习路由的时候,添加了


 Route::post('test', function()
{
    return 'test';
});

然后访问 http://localhost/laravel/test 却一直是404,是哪里的问题呢?

laravel5 php

Horacio 8 years, 9 months ago

第一,首先这是一个 post 路由,如果是 http://localhost/laravel/test 访问的话:


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

第二,请检查你的服务器重(Apache or Nginx)写规则是否符合laravel的规则

第三,为什么不直接用php artisan serve呢

第四:我最近上线的社区,免费视频教程: https://laravist.com/ 有laravel相关的问题可以到这里问我,几乎全天守候。。哈哈哈哈

一起戳便便 answered 8 years, 9 months ago

Your Answer