【问题标题】:Magento simplexml_load_string() error locationMagento simplexml_load_string() 错误位置
【发布时间】:2015-08-30 18:40:10
【问题描述】:

我有一个非常烦人的问题。当我遇到 simplexml_load_string() 错误时,我正在对 Magento 商店进行一些更改,我很清楚这个错误是由一些错误的 XML 文件引起的,但对我来说非常重要的问题是哪个文件以及它在哪里? 这是我收到的错误消息,我一直不太擅长理解这些控制台类型的消息,有人可以帮帮我吗?

Warning: simplexml_load_string(): Entity: line 1: parser error : StartTag: invalid element name  in /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php on line 450

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/var/www/html/a...', 450, Array)
#1 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(450): simplexml_load_string('< ?xml version=...', 'Mage_Core_Model...')
#2 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(275): Mage_Core_Model_Layout_Update->getFileLayoutUpdatesXml('frontend', 'MyTheme', 'Responsive', '1')
#3 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(347): Mage_Core_Model_Layout_Update->fetchFileLayoutUpdates()
#4 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(246): Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates('default')
#5 /var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php(224): Mage_Core_Model_Layout_Update->merge('default')
#6 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(306): Mage_Core_Model_Layout_Update->load()
#7 /var/www/html/app/code/core/Mage/Cms/Helper/Page.php(109): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#8 /var/www/html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'about-magento-d...')
#9 /var/www/html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'about-magento-d...')
#10 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#11 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 /var/www/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /var/www/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 /var/www/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#15 /var/www/html/index.php(91): Mage::run('', 'store')
#16 {main}

【问题讨论】:

    标签: php xml magento


    【解决方案1】:

    这与/var/www/html/app/code/core/Mage/Core/Model/Layout/Update.php 有关,所以我将编辑该文件并转到第 450 行。

    就在那一行之前写:

    Mage::log(print_r($filename, true));
    

    确保您的日志记录已启用并刷新页面。之后,查看 var/log/system.log。最后一个 xml 可能是您正在搜索的内容。

    【讨论】:

    • 先生,您救了我的命,谢谢!原来 Magento 在 XML 文件的开始标记之后添加了一个空格,这就是问题所在。在您的帮助下,我能够找到错误的文件并修复它。再次感谢! :)
    猜你喜欢
    • 1970-01-01
    • 2013-08-03
    • 2013-02-14
    • 2011-02-23
    • 1970-01-01
    • 2022-11-10
    • 1970-01-01
    • 2020-02-19
    • 2019-02-25
    相关资源
    最近更新 更多