Skip to content

Instantly share code, notes, and snippets.

@k-holy
Created December 13, 2011 23:56
Show Gist options
  • Save k-holy/1474541 to your computer and use it in GitHub Desktop.
Save k-holy/1474541 to your computer and use it in GitHub Desktop.
PHP5.4ビルトインサーバのルータースクリプト
<?php
// ポート8080の場合、ショートカットのリンク先 C:\php5.4\php.exe -S 127.0.0.1:8080 built-in-server.php
// 作業フォルダにドキュメントルートを入力して起動
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (strcmp('/', $path) !== 0) {
if (file_exists(realpath(__DIR__ . $path))) {
return false;
}
}
require __DIR__ . DIRECTORY_SEPARATOR . 'index.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment