安装Magento2.3之后运行主页以及后台会错误


报错如下:

 1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'E:/WWW/magento/app/design/frontend/Mgs/hebes/Magento_Theme/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js' 

解决方案如下:

<strong>vendor/magento/framework/View/Element/Template/File/Validator.php</strong>文件中修改下列代码

protected function isPathInDirectories($path, $directories)
{
    if (!is_array($directories)) {
        $directories = (array)$directories;
    }
    $realPath = $this->fileDriver->getRealPath($path);
    $realPath = str_replace('\\', '/', $realPath); // extra code added
    foreach ($directories as $directory) {
        if (0 === strpos($realPath, $directory)) {
            return true;
        }
    }
    return false;
}