如何去掉

1.

http://localhost/sjx/public/articles/1

//Route::get('/articles','ArticlesController@index');
//Route::get('/articles/{$id}','ArticlesController@show');

按照课程上讲的就是show 方法报错

Sorry, the page you are looking for could not be found.
Route::resource('articles', 'ArticlesController');

这样请求就没问题
但是改成这种方法后就好使了,是忘记添加什么引用了么

2.请问一下如何去掉public目录哈直接显示成

localhost/sjx/articles/1

这种形式

webserver 里把域名直接指向 public 这个目录,让 访问 / 就是 public/index.php 这个文件

justtest

webserver 里把域名直接指向 public 这个目录,让 访问 / 就是 public/index.php 这个文件

ahuang

这标题。。。。

xiaonu

@justtest 谢谢

TomatoMr

这两个问题是同一个,你要把网站根目录改到“public”下,不然按照教程去做,laravel去找的并不是你请求的路径,自然就找不到这个页面了。

xiaonu

@TomatoMr 好的,谢谢