【发布时间】:2016-08-21 16:57:27
【问题描述】:
我是一个新的 laraveler,现在我正在处理有关 laravel 的问题。我想将/ 直接发送给钓鱼者index.html。和其他路由到 laravel 控制器。但是当\直接好了。其他路由到 views 目录时出错。\app\Http\route.php 如下:
Route::get('/',function(){
return File::get(public_path().('/views/index.html'));
});
Route::get('scan', "userController@Scan");
Route::get('check', "userController@Check");
Route::get('login', "userController@Login");
directy 如下所示:
├── app
│ ├── Http
│ │ ├── route.php //route file
│ ├── Library
│ ├── Providers
│ ├── Services
│ ├── User.php
│ └── views
│ │ ├── Index.php // php index file , the entry for nginx server
│ └── ..........
├── bootstrap
│ ├── app.php
│ ├── autoload.php
│ └── cache
├── config
│ ├── app.php
│ └── view.php
│ └── ..........
├── public
│ ├── bower_components
│ ├── css
│ ├── data
│ ├── index.bak
│ ├── index.html //angular index file
│ └── scripts
│ └── ..........
现在当我访问 http://hostname/scan 时,它会出现 404 未找到。
日志如下: ``` *2221 open() "/service/angular-laravel/app/views/scan" 失败(2:没有这样的文件或目录),客户端:x.x.x.x,服务器:主机名,请求:"GET /scan HTTP/1.1",主机: "banliyun.com:8081"
```
因为我对路线的运作方式有些困惑。谁能告诉我为什么它会路由到放置 laravel 索引页面的 /views 目录。
【问题讨论】: