Magento2-2.3.4 windows安装完magento无法加载静态资源导致无法进入后台登录页面

后台面无法进入,截图如下

首先查看var/log/system.log日志文件,发现报错信息如下

RROR: Error: Application is not installed yet.  [] []
[2020-03-25 00:16:08] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 00:53:11] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:27:55] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:39:38] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:42:31] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 12:56:42] main.ERROR: Unable to proceed: the maintenance mode is enabled.  [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Translation/view/base/templates/translate.phtml' in module: 'Magento_Translation' block's name: 'translate' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/components.phtml' in module: '' block's name: 'head.components' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/js/calendar.phtml' in module: '' block's name: 'head.calendar' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Cookie/view/base/templates/html/cookie.phtml' in module: '' block's name: 'cookie_config' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Ui/view/base/templates/logger.phtml' in module: 'Magento_Ui' block's name: 'logger' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Ui/view/base/templates/wysiwyg/active_editor.phtml' in module: 'Magento_Ui' block's name: 'theme.active.editor' [] []
[2020-03-25 13:03:11] main.CRITICAL: Invalid template file: 'D:/phpstudy_pro/WWW/magento2-2.3.4/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml' in module: 'Magento_Backend' block's name: 'logo' [] []

解决方法

找到lib\internal\Magento\Framework\View\Element\Template\File\Validator.php文件中的isPathInDirectories方法

$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));替换$realPath = $this->fileDriver->getRealPath($path);

看结果

如果还是不行,可以尝试如下操作

INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;

php bin/magento cache:clean

猜你喜欢

转载自www.cnblogs.com/IT-Crowd/p/12571611.html
今日推荐