解析错误:语法错误,意外的“公共"(T_PUBLIC) [英] Parse error: syntax error, unexpected 'public' (T_PUBLIC)

查看:886
本文介绍了解析错误:语法错误,意外的“公共"(T_PUBLIC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在magento管理页面上的重定向基本网址"选项中进行了更改.但是,效果不佳.之后,出现以下错误:

I changed something in my "redirect base url" options on the magento admin page. However, that didnt work out that well. After that I got the following error:

解析错误:语法错误,..../public_html/app/code/core/Mage/Core/Model/Config.php中第662行上的意外公开"(T_PUBLIC)

使用代码:

public function setNode($path, $value, $overwrite = true)
{
    if ($this->_useCache && ($path !== null)) {
        $sectionPath = explode('/', $path);
        $config = $this->_getSectionConfig($sectionPath);
        if ($config) {
            $sectionPath = array_slice($sectionPath, $this->_cacheSections[$sectionPath[0]]+1);
            $sectionPath = implode('/', $sectionPath);
            $config->setNode($sectionPath, $value, $overwrite);
        }
    }
    return parent::setNode($path, $value, $overwrite);
}

我自己无法解决问题,因为我是这种菜鸟的菜鸟.有人可以帮我吗?:)

I cannot figure out the problem myself as Im a rookie with this kind of stuff. Could anybody perhaps help me out?:)

推荐答案

在Opencart项目中工作时,我的代码也遇到了同样的问题. 经过数小时的挫折,我意识到造成此问题的原因是没有关闭最后一个功能.

I had same problem with my code when I was working in an Opencart Project. After several hours of frustration I realized that the cause of this issue was the absence of closure of last function.

我忘记关闭其上方的功能,即 } 丢失了,所以就像在另一个函数中定义一个函数一样.您是否检查过您的情况是否相同.

I forgot to close the function above it i.e. } was missing so it was like defining a function inside another function. Have you checked if that's the same case with you.

这篇关于解析错误:语法错误,意外的“公共"(T_PUBLIC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆