本文整理匯總了PHP中Magento\Framework\Filesystem\Directory\Write::read方法的典型用法代碼示例。如果您正苦於以下問題:PHP Write::read方法的具體用法?PHP Write::read怎麽用?PHP Write::read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\Filesystem\Directory\Write
的用法示例。
在下文中一共展示了Write::read方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: beforeDispatch
/**
* Clear temporary directories
*
* @param \Magento\Install\Controller\Index\Index $subject
* @param \Magento\Framework\App\RequestInterface $request
*
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function beforeDispatch(\Magento\Install\Controller\Index\Index $subject, \Magento\Framework\App\RequestInterface $request)
{
if (!$this->appState->isInstalled()) {
foreach ($this->varDirectory->read() as $dir) {
if ($this->varDirectory->isDirectory($dir)) {
try {
$this->varDirectory->delete($dir);
} catch (FilesystemException $exception) {
$this->logger->log($exception->getMessage());
}
}
}
}
}
示例2: _deleteFilesRecursively
/**
* Delete all files in a directory recursively
*
* @param string $targetDir
* @return void
*/
protected function _deleteFilesRecursively($targetDir)
{
if ($this->_directory->isExist($targetDir)) {
foreach ($this->_directory->read($targetDir) as $path) {
$this->_directory->delete($path);
}
}
}