✏️ 编辑:clear-cache.php
路径:
/home/boguraj1/public_html/udoktaecom/public/clear-cache.php
大小:1.4 KB · 修改:2026-07-23 22:13:46 · 权限:0644 · 可写
← 返回目录
👁 查看
⬇ 下载
<?php // One-time cache clear — DELETE THIS FILE after running $token = $_GET['token'] ?? ''; if ($token !== 'tmit_clear_2024') { die('Unauthorized'); } $root = dirname(__DIR__); $cleared = []; $errors = []; // Clear compiled views $viewsDir = $root . '/storage/framework/views'; if (is_dir($viewsDir)) { foreach (glob($viewsDir . '/*.php') as $file) { if (unlink($file)) { $cleared[] = basename($file); } else { $errors[] = basename($file); } } } // Clear route cache foreach ([ $root . '/bootstrap/cache/routes-v7.php', $root . '/bootstrap/cache/routes.php', $root . '/bootstrap/cache/config.php', $root . '/bootstrap/cache/packages.php', $root . '/bootstrap/cache/services.php', ] as $file) { if (file_exists($file)) { if (unlink($file)) { $cleared[] = basename($file); } } } echo '<style>body{font-family:sans-serif;max-width:600px;margin:40px auto;padding:20px}</style>'; echo '<h2>✅ Cache Cleared</h2>'; echo '<p><strong>' . count($cleared) . ' files cleared:</strong></p>'; echo '<ul>'; foreach ($cleared as $f) echo "<li>$f</li>"; echo '</ul>'; if ($errors) { echo '<p style="color:red"><strong>Failed:</strong></p><ul>'; foreach ($errors as $f) echo "<li>$f</li>"; echo '</ul>'; } echo '<p style="color:red;font-weight:bold">⚠️ DELETE this file now: public/clear-cache.php</p>';
💾 保存
取消
保存为 UTF-8,换行统一为 LF