管理面板和主页无法正确加载

成功安装Magento 2.3.3之后。

管理面板显示黑屏或无法正确加载。

默认主题未加载到主页上。

控制台上也有错误。

zsdgr89456789000zzh7 回答:管理面板和主页无法正确加载

首先,您需要在计算机上安装composer。

链接:https://getcomposer.org/

  

对于Magento中的PHP,Composer是必需的。它是PHP的依赖项管理器。

对于管理面板的空白屏幕:

转到您的项目文件夹,然后转到下面的文件-

/vendor/magento/framework/View/Element/Template/File/Validator.php:140

然后替换

if (0 === strpos($realPath,$directory)) {
    return true;
}

使用

$realDirectory = $this->fileDriver->getRealPath($directory);
if (0 === strpos($realPath,$realDirectory)) {
   return true;
}

对于无法正确加载和缺少默认主题的情况:

转到您的项目文件夹,然后转到下面的文件-

/var/cache -> *DELETE ALL*

/var/page_cache -> *DELETE ALL*

/var/session > *DELETE ALL*

/pub/static -> DELETE ALL ***EXCEPT .HTACCESS***

现在运行以下命令-

(在运行命令之前运行服务器,否则会显示错误。)

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy -f

php bin/magento cache:flush

//如果您使用的是Mac或Linux

sudo chmod -R 0777 var/ pub/ generated/

本文链接:https://www.f2er.com/3138652.html

大家都在问