Invalid template file

在作magento2遷移時提示錯誤
1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'D:/bk/bkmall-web-revamp/app/design/frontend/Mgs/hebes/Magento_Theme/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'php

For me, solution worked is by going to the file vendormagentoframeworkViewElementTemplateFileValidator.php and replacing the below function definition as below:
`html

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

`web

相關文章
相關標籤/搜索