我正在使用Magento2,当我登录我的网站时,我收到了这条消息。
处理您的请求时出错 指定无效 父 ID (Magento_Backend::mgs) 错误日志记录编号: 1307308720759
这个网站运行良好,但最后我运行查询并重新编译,然后这个问题开始出现......
以下错误日志详细信息
{"0":"指定的无效父 ID (Magento_Backend::mgs)","1":"#0/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\Model\Menu\Builder->getResult(Object(Magento\Backend\Model\Menu))#1/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Backend\Model\Menu\Builder\Interceptor->___callParent('getResult', 数组)#2/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Backend\Model\Menu\Builder\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Backend\Model\Menu))#3/home/gervetus/public_html/generated/code/Magento/Backend/Model/Menu/Builder/Interceptor.php(26): Magento\Backend\Model\Menu\Builder\Interceptor->___callPlugins('getResult', 数组,阵列)#4/home/gervetus/public_html/vendor/magento/module-backend/Model/Menu/Config.php(148): Magento\Backend\Model\Menu\Builder\Interceptor->getResult(Object(Magento\Backend\Model\Menu))#5/home/gervetus/public_html/vendor/magento/module-backend/model/Menu/Config.php(111): Magento\Backend\Model\Menu\Config->_initMenu()#6/home/gervetus/public_html/vendor/magento/module-backend/Model/Url.php(361): Magento\Backend\Model\Menu\Config->getMenu()#7/home/gervetus/public_html/vendor/magento/module-backend/model/Url.php(321): Magento\Backend\Model\Url->_getMenu()#8/home/gervetus/public_html/generated/code/Magento/Backend/Model/Url/Interceptor.php(102): Magento\Backend\Model\Url->getStartupPageUrl()#9/home/gervetus/public_html/vendor/magento/module-backend/App/AbstractAction.php(276): Magento\Backend\Model\Url\Interceptor->getStartupPageUrl()#10/home/gervetus/public_html/vendor/magento/module-backend/App/AbstractAction.php(208): Magento\Backend\App\AbstractAction->_processUrlKeys()#11/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))#12/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->___callParent('dispatch', 数组)#13/home/gervetus/public_html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))#14/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))#15/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))#16/home/gervetus/public_html/generated/code/Magento/Backend/Controller/Adminhtml/Index/Index/Interceptor.php(26): Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->___callPlugins('dispatch', 数组,空)#17/home/gervetus/public_html/vendor/magento/framework/App/FrontController.php(55): Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))#18/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))#19/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', 数组)#20/home/gervetus/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))#21/home/gervetus/public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', 数组,数组)#22/home/gervetus/public_html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))#23/home/gervetus/public_html/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http->launch()#24/home/gervetus/public_html/index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))#25 {main}","url":"/admin/admin/index/index/key/6570ae1e6f609b1c1c0433e9e2307b5d7250e1e160091871b57a4326817cae2e/","script_name":"/index.php"}
只需修改位于/vendor/magento/module-cms/etc/adminthml/menu下的菜单文件.xml
<add id="Magento_Backend::mgs" title="Blocks" translate="title" module="Magento_Cms" sortOrder="30" parent="Magento_Backend::mgs" action="cms/block" resource="Magento_Cms::block"/>
这是它的外观
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Magento_Cms::cms_page" title="Pages" translate="title" module="Magento_Cms" sortOrder="0" parent="Magento_Backend::content_elements" action="cms/page" resource="Magento_Cms::page"/>
<add id="Magento_Cms::cms_block" title="Blocks" translate="title" module="Magento_Cms" sortOrder="30" parent="Magento_Backend::content_elements" action="cms/block" resource="Magento_Cms::block"/>
<add id="Magento_Backend::mgs" title="Blocks" translate="title" module="Magento_Cms" sortOrder="30" parent="Magento_Backend::mgs" action="cms/block" resource="Magento_Cms::block"/>
</menu>
</config>
根据错误,mgs 没有任何父 ID 名称,因此它会抛出错误。
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Magento_Cms::cms_page" title="Pages" module="Magento_Cms" sortOrder="0" parent="Magento_Backend::content_elements" action="cms/page" resource="Magento_Cms::page"/>
<add id="Magento_Cms::cms_block" title="Blocks" module="Magento_Cms" sortOrder="30" parent="Magento_Backend::content_elements" action="cms/block" resource="Magento_Cms::block"/>
</menu>
在上面的代码中parent="Magento_Backend::content_elements"
将显示在内容菜单中,因此请为您的菜单提供有效的id
,然后它将起作用。
有关参考,请参阅此链接