我已经在本地机器上安装了Magento 2.3,安装很顺利。我可以在localhost/magento
访问我的商店。我试图访问我的管理页面localhost/magento/admin_pogi
,但它给了我一个空白页面,并重定向到urlhttp://localhost/magento/admin_pogi/admin/index/index/key/a062e79f617010c42b07d662103d5142cd9bbe86314fb54da3e4cb5542b11eee/
。
到目前为止,我所尝试的是启用开发模式,我在我的管理页面上看到了这个错误:
1 exception(s):
Exception #0 (MagentoFrameworkExceptionValidatorException): Invalid
template file: 'C:/xampp/htdocs/magento/vendor/magento/module- backend/view/adminhtml/templates/page/js/require_js.phtml' in module:
'Magento_Backend' block's name: 'require.js'
Exception #0 (MagentoFrameworkExceptionValidatorException): Invalid template file: 'C:/xampp/htdocs/magento/vendor/magento/module-backend/view/adminhtml/templates/page/js/require_js.phtml' in module: 'Magento_Backend' block's name: 'require.js'
#0 C:xampphtdocsmagentovendormagentoframeworkViewElementTemplate.php(301):
MagentoFrameworkViewElementTemplate->fetchView('C:/xampp/htdocs...')
#1 C:xampphtdocsmagentovendormagentoframeworkViewElementAbstractBlock.php(668): MagentoFrameworkViewElementTemplate->_toHtml()#2
C:xampphtdocsmagentovendormagentoframeworkViewResultPage.php(249):
MagentoFrameworkViewElementAbstractBlock->toHtml()
#3
C:xampphtdocsmagentovendormagentoframeworkViewResultLayout.php(171): MagentoFrameworkViewResultPage->render(Object(MagentoFrameworkAppResponseHttpInterceptor))
#4 C:xampphtdocsmagentogeneratedcodeMagentoBackendModelViewResultPageInterceptor.php(193): MagentoFrameworkViewResultLayout->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
#5 C:xampphtdocsmagentovendormagentoframeworkAppHttp.php(139): MagentoBackendModelViewResultPageInterceptor->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
#6 C:xampphtdocsmagentogeneratedcodeMagentoFrameworkAppHttpInterceptor.php(24): MagentoFrameworkAppHttp->launch()
#7 C:xampphtdocsmagentovendormagentoframeworkAppBootstrap.php(258): MagentoFrameworkAppHttpInterceptor->launch()
#8 C:xampphtdocsmagentoindex.php(39): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttpInterceptor))
#9 {main}
这将是一个解决此提交的错误。作者将$path
更改为
$this->fileDriver->getRealPath($path)
它只是在$path
上调用realpath()
,但可能会更改先前受影响的$path
上的目录分隔符
#/vendor/magento/framework/View/Element/Template/File/Validator.php:114
$filename = str_replace('\', '/', $filename);
在Windows操作系统上,这将恢复以上str_replace
的更改,以便像这样的路径
D:/Magento2.3/vendor/magento
将被规范化为其Windows特定版本:
D:Magento2.3vendormagento
并且这不会导致在CCD_ 10类的CCD_
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
解决方案
目前,我们可以在上面的foreach
循环中进行一个肮脏的快速更改,这样我们就可以运行我们的magento,而不会出现进一步的问题:
#/vendor/magento/framework/View/Element/Template/File/Validator.php:139
foreach ($directories as $directory) {
// Add this line
$realDirectory = $this->fileDriver->getRealPath($directory);
// and replace `$directory` with `$realDirectory`
if (0 === strpos($realPath, $realDirectory)) {
return true;
}
}
步骤01。转到此目录C: \examplep\htdocs\magento\vendor\magento\framework\View\Element\Template\File
步骤02。打开文件验证器.php注释行139($realPath=$this->fileDriver->getRealPath($path(;(添加此代码
$realPath=str_replace('\','/', $this->fileDriver->getRealPath($path));
还有一些时间管理页面加载但不加载css所以如何修复这个问题
步骤_01转到该目录App/etc/di.xml
步骤02查找此行
<item name="view_preprocessed" xsi:type="object">MagentoFrameworkAppViewAssetMaterializationStrategySymlink</item>
步骤03将其更改为低于
<item name="view_preprocessed" xsi:type="object">MagentoFrameworkAppViewAssetMaterializationStrategycopy</item>
还有一段时间主页加载不正确,如何解决
步骤01转到此目录var/cache
步骤02删除缓存文件并刷新页面
这是Magento 2.3.0的核心问题。要解决这个问题,你必须更改Magento核心文件中的代码。
转到路径/vender/magento/framework/View/Element/Template/File/Validator.php在此文件中找到:
$realPath = $this->fileDriver->getRealPath($path);
替换为:
$realPath = str_replace('\', '/', $this->fileDriver->getRealPath($path));