使用 storage_path 读取 session 目录然后遍历删除即可 while (($file = readdir(opendir(storage_path('framework/sessions')))) !== false) { if ($file != "." && $file != "..") { @unlink("$dir/$file") } }
使用
storage_path
读取session
目录然后遍历删除即可