【问题标题】:PHP Laravel v5.7.0 Getting 404 Page Not Found for Equipment Resource ControllerPHP Laravel v5.7.0 获取设备资源控制器的 404 页面未找到
【发布时间】:2019-05-16 21:00:04
【问题描述】:

我在显示设备资源控制器的 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&#176C;</td>
                </tr>
                <tr>
                     <td>Chiller 2</td>
                     <td>32&#176C;</td>
                </tr>
                <tr>
                     <td>Chiller 3</td>
                     <td>32&#176C;</td>
                </tr>
            </tbody>
        </table>
     </body>
 </html>

我已经尝试过 'php artisan cache:clear' 没有效果。请告诉我我做错了什么。谢谢!

【问题讨论】:

    标签: php laravel


    【解决方案1】:

    我发现我做错了什么。使用上面的配置,我一直在尝试访问 URL '127.0.0.1:8000/equipments' 而不是 '127.0.0.1:8000/equipment',如 'php artisan route:list' 中的路由所示。

    【讨论】:

      猜你喜欢
      • 2021-11-16
      • 2021-02-06
      • 1970-01-01
      • 2013-10-04
      • 2016-06-22
      • 2020-07-31
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多