【问题标题】:My page could not be found, can someone help me?找不到我的页面,有人可以帮我吗?
【发布时间】:2019-09-10 03:37:04
【问题描述】:

这是我在控制器中的功能

public function list()
    {
            $customers = Customer::all();
            foreach ($customers as $customer) {
                $list = [

                    'Customer ID' => $customer->id,
                    'Customer Name' => $customer->full_name,
                ];
                $lists[] = $list;
            }
            $collection = $this->paginate($lists, $perPage = 5, $page = null, $options = []);
            return new mainCollection($collection);
    }

这是我的路线

Route::get('customers/list', 'customerController@list')

当我在 PostMan 中访问 http://127.0.0.1:8000/api/customers/list 时出现错误 404 Not Found 另一条路线运作良好。 有人可以帮我吗?

【问题讨论】:

  • 你能发布你的 api.php 路由文件和完整的控制器代码吗?
  • 我的控制器太大了,放不下
  • 检查 php artisan route:list / 仔细检查您的路线信息。另外,检查你的控制器类名和命名空间。
  • 你能接受评论作为答案吗?
  • 我该怎么做?

标签: laravel api postman


【解决方案1】:

检查php artisan route:list / 仔细检查您的路线信息。

另外,检查你的控制器类名和命名空间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-18
    • 2016-07-25
    • 1970-01-01
    • 2022-06-14
    • 2020-09-09
    相关资源
    最近更新 更多