升级后不在对象上下文中时使用$ this错误

时间:2018-09-20 08:59:45

标签: php cakephp cakephp-2.0 upgrade

我将我的应用程序从cakephp 1.3更新到了2.4,但是我有很多错误,而且我不知道该如何解决...在建立数据库连接并更正其他错误之后,出现了此错误。这是显示错误的屏幕截图:error after update 这是导致错误的index.ctp部分:

$this->request->webroot

我将$this->webroot替换为if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { $this->_currentType = self::TYPE_VIEW; $this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($viewFileName))); $this->Blocks->set('content', $this->_render($viewFileName)); $this->getEventManager()->dispatch(new CakeEvent('View.afterRender', $this, array($viewFileName))); } ,但仍然行不通...为什么有任何主意?这是view.php第473行错误:

function getPrimaryPicture($var,$toImage,$image,$field,$path)
    {
        unset($poza);
        if(empty($var[$toImage]))
        {
            $poza = $this->webroot.'css/front/default_image.png';
        }
        else
        {
            foreach($var[$toImage] as $img)
            {
                if(isset($var[$image])){
                    if($var[$image][$field]==$img['id'])
                    {
                        $poza = $this->webroot.'uploaded/'.$path.'/thumb_'.$img['name'];
                    }
                }else{
                    if($var[$field]==$img['id'])
                    {
                        $poza = $this->webroot.'uploaded/'.$path.'/thumb_'.$img['name'];
                    }
                }
            }
            if(!isset($poza))
            {
                 $poza = $this->webroot.'uploaded/'.$path.'/thumb_'.$var[$toImage][0]['name'];
            }
        }
        return $poza;
    }

这是getPrimaryPicture函数:

InputMultiplexer

0 个答案:

没有答案