Spaces:
Running
Running
Download api/index.php from buddhaword/web: direct link, hf CLI and curl.
- Browser
- Download file 1.64 kB
-
https://huggingface.co/spaces/buddhaword/web/resolve/main/api/index.php
- Command line
-
hf download hf://spaces/buddhaword/web/api/index.php
-
curl -L -o index.php https://huggingface.co/spaces/buddhaword/web/resolve/main/api/index.php
1.64 kB
| session_start(); | |
| ini_set('display_errors', 0); | |
| ini_set('display_startup_errors', 0); | |
| error_reporting(0); | |
| // Normalize SCRIPT_NAME so Router & url() helper work correctly on Vercel | |
| $_SERVER['SCRIPT_NAME'] = '/index.php'; | |
| if (file_exists(__DIR__ . '/../.env')) { | |
| $lines = file(__DIR__ . '/../.env', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); | |
| foreach ($lines as $line) { | |
| $line = trim($line); | |
| if (empty($line) || strpos($line, '#') === 0) continue; | |
| if (strpos($line, '=') !== false) { | |
| list($name, $value) = explode('=', $line, 2); | |
| $_ENV[trim($name)] = trim($value); | |
| putenv(trim($name) . '=' . trim($value)); | |
| } | |
| } | |
| } | |
| $composerAutoload = __DIR__ . '/../vendor/autoload.php'; | |
| if (file_exists($composerAutoload)) { | |
| require $composerAutoload; | |
| } | |
| spl_autoload_register(function ($class) { | |
| $prefix = 'App\\'; | |
| $base_dir = __DIR__ . '/../app/'; | |
| $len = strlen($prefix); | |
| if (strncmp($prefix, $class, $len) !== 0) return; | |
| $relative_class = substr($class, $len); | |
| $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; | |
| if (file_exists($file)) require $file; | |
| }); | |
| require_once __DIR__ . '/../app/Helpers/view.php'; | |
| require_once __DIR__ . '/../app/Helpers/http.php'; | |
| require_once __DIR__ . '/../app/Helpers/cache.php'; | |
| header('X-Content-Type-Options: nosniff'); | |
| header('X-Frame-Options: DENY'); | |
| header('Referrer-Policy: strict-origin-when-cross-origin'); | |
| header('X-XSS-Protection: 1; mode=block'); | |
| $routes = require_once __DIR__ . '/../routes/web.php'; | |
| $router = new App\Core\Router($routes); | |
| $router->dispatch(); | |