【问题标题】:Cannot use object of type Illuminate\Http\Response as array (Larravel/October CMS)不能将 Illuminate\Http\Response 类型的对象用作数组(Larravel/October CMS)
【发布时间】:2019-12-13 13:31:49
【问题描述】:

我在单击菜单(构建)时遇到此错误,所以我不明白。有人可以帮助我吗?为什么下面这一行会发生这种情况?

     public function run($url = null)
    {
        $params = RouterHelper::segmentizeUrl($url);

        // Handle NotFoundHttpExceptions in the backend (usually triggered by abort(404))
        Event::listen('exception.beforeRender', function ($exception, $httpCode, $request) {
            if (!$this->cmsHandling && $exception instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
                return View::make('backend::404');
            }
        }, 1);

        /*
         * Database check
         */
        if (!App::hasDatabase()) {
            return Config::get('app.debug', false)
                ? Response::make(View::make('backend::no_database'), 200)
                : $this->passToCmsController($url);
        }

 the erro start happining at this line---------->

        $controllerRequest = $this->getRequestedController($url);
        if (!is_null($controllerRequest)) {
            return $controllerRequest['controller']->run(
                $controllerRequest['action'],
                $controllerRequest['params']
            );
        }

        /*
         * Fall back on Cms controller
         */
        return $this->passToCmsController($url);
    }

【问题讨论】:

  • 我是 laravel 和 october cms 的新手,无法确切了解发生了什么。但你说的完全有用。我要检查一下。如果你们需要更多信息来拯救我,请告诉我
  • 我只是编辑和分享所有课程,让和平人有一个想法可能会比以前更清楚......我不知道
  • 你能告诉我们getRequestedController是什么吗?
  • 这有点难,但我可以向你展示所有的公共功能。我没有创造任何东西。我不知道你是否知道,但是因为我只是使用 CMS October 所以它只是单独创建一些代码,我刚开始同时学习 October 和 Laravel。
  • 这是新安装的 OctoberCMS 吗?你的 PHP 版本是多少?

标签: laravel octobercms


【解决方案1】:

要制作视图,您无需做出响应。而不是

响应::make(查看::make('backend::no_database'), 200)

使用

return View::make('backend::no_database');

或者这个用于自定义页面

return View::make('author.plugin::backend.file'); # htm is on views/backend/file.htm

顺便检查一下上面的同一个文件,它有return View::make('backend::404');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-09
    • 1970-01-01
    • 1970-01-01
    • 2017-02-06
    • 2021-01-03
    • 2021-08-15
    • 2018-04-12
    • 1970-01-01
    相关资源
    最近更新 更多