发布于 4年前
在做magento2迁移时提示错误 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'
For me, solution worked is by going to the file vendormagentoframeworkViewElementTemplateFileValidator.php and replacing the below function definition as below:
`
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; }
`