gpt4 book ai didi

javascript - 本地主机中 Magento 2.3.0 CE 上的空白管理页面

转载 作者:可可西里 更新时间:2023-11-01 12:46:40 26 4
gpt4 key购买 nike

我已经在本地机器上安装了 Magento 2.3,安装正常。我可以在 localhost/magento 访问我的商店。我试图访问我的管理页面 localhost/magento/admin_pogi 但它给了我一个空白页面并重定向到 url http://localhost/magento/admin_pogi/admin/index/index/键/a062e79f617010c42b07d662103d5142cd9bbe86314fb54da3e4cb5542b11eee/

到目前为止我尝试的是启用开发模式,但我在我的管理页面上看到了这个错误:

1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): 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 (Magento\Framework\Exception\ValidatorException): 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:\xampp\htdocs\magento\vendor\magento\framework\View\Element\Template.php(301):
Magento\Framework\View\Element\Template->fetchView('C:/xampp/htdocs...')
#1 C:\xampp\htdocs\magento\vendor\magento\framework\View\Element\AbstractBlock.php(668): Magento\Framework\View\Element\Template->_toHtml()#2
C:\xampp\htdocs\magento\vendor\magento\framework\View\Result\Page.php(249):
Magento\Framework\View\Element\AbstractBlock->toHtml()
#3
C:\xampp\htdocs\magento\vendor\magento\framework\View\Result\Layout.php(171): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#4 C:\xampp\htdocs\magento\generated\code\Magento\Backend\Model\View\Result\Page\Interceptor.php(193): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#5 C:\xampp\htdocs\magento\vendor\magento\framework\App\Http.php(139): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#6 C:\xampp\htdocs\magento\generated\code\Magento\Framework\App\Http\Interceptor.php(24): Magento\Framework\App\Http->launch()
#7 C:\xampp\htdocs\magento\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http\Interceptor->launch()
#8 C:\xampp\htdocs\magento\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#9 {main}

最佳答案

这将是一个解决 this commit 的错误.作者将 $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.3\vendor\magento

这不会导致在 Magento\Framework\View\Element\Template\File\Validator 类的 isPathInDirectories() 方法中进行成功比较:

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;
}
}

关于javascript - 本地主机中 Magento 2.3.0 CE 上的空白管理页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53551878/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com