$om = \Magento\Framework\App\ObjectManager::getInstance();
$filesystem = $om->get('Magento\Framework\Filesystem');
$directoryList = $om->get('Magento\Framework\App\Filesystem\DirectoryList');
$varDirectory = $filesystem->getDirectoryWrite($directoryList::VAR_DIR);
$varPath = $directoryList->getPath('var');
$fileName = 'demo.txt';
$path = $varPath . '/custom/' . $fileName;
$error = [];
$contents = print_r($error, true);
$varDirectory->writeFile($path, $contents);
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)