php - PHP Laravel v5.7.0 获取设备资源控制器的 404 页面未找到
问题描述
我在显示设备资源控制器的 index.blade.php 视图时收到错误 404 Page Not Found。
这是我的文件:
App\Http\Controllers\EquipmentController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class EquipmentController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return View::make('equipments.index');
}
...
}
路线\web.php
Route::resource('equipment', 'EquipmentController');
资源\视图\设备\index.blade.php
<!DOCTYPE html>
<html>
<head>
<title>Equipment</title>
</head>
<body>
<table>
<thead>
<th>Chillers</th>
<th>Setpoint</th>
</thead>
<tbody>
<tr>
<td>Chiller 1</td>
<td>32°C;</td>
</tr>
<tr>
<td>Chiller 2</td>
<td>32°C;</td>
</tr>
<tr>
<td>Chiller 3</td>
<td>32°C;</td>
</tr>
</tbody>
</table>
</body>
</html>
我已经尝试过 'php artisan cache:clear' 没有效果。请告诉我我做错了什么。谢谢!
解决方案
我发现我做错了什么。使用上面的配置,我一直在尝试访问 URL '127.0.0.1:8000/equipments' 而不是 '127.0.0.1:8000/equipment',如 'php artisan route:list' 中的路由所示。
推荐阅读
- javascript - 在javascript中需要一个正则表达式
- react-native - 如何使用 Expo 修复 ReactNative 中的“未捕获错误:不变违规”错误?
- react-native - 使用地理定位 react-native 时出错
- adal - 使用 clientsecret MSAL 注册的应用程序必须设置什么范围
- flutter - 如何包装 RadioButtonGroup 的标签?我在哪里可以提供扩展或灵活?
- delphi - 我想用 AES 加密 TidBytes
- javascript - 滚动到 Div 时 Javascript 加载更多
- php - 如何在引导程序 4 中修复动态图像
- pyspark-sql - 在 PySpark DataFrame 上运行 sql 查询
- ksqldb - 我可以在 KSQL 中按两列分区吗