/**
* 删除文件缓存
*/
public function actionDelfilecache()
{
$cachePath = Yii::getAlias('@app/runtime/cache');//文件绝对路径
$fileArray = scandir($cachePath);//将文件夹中的文件升序排列
foreach($fileArray as $fileName) {
if($fileName != "." && $fileName != ".."){
if(is_dir($cachePath . '/' . $fileName)) {
//递归地删除一个目录(及其所有内容)yii2.0
FileHelper::removeDirectory($cachePath . '/' . $fileName);
} else {
unlink($cachePath . '/' . $fileName);
}
}
}
}