windows8.1

cygwinでphpビルトインサーバを用いて、

phalconフレームワークを動かしてみた。

 

予めやっておくことは、

  • ビルドできる環境
  • phpおよび関連モジュールのインストール
  • phalconのインストール(linuxの方法でcygwinもできます)

です。

 

そして、

サンプルのinvoをダウンロードして、

公開ディレクトリに移動して、

php -S localhost:8000 routing.php

をたたけば起動する。

 

ここで、あらかじめ以下2点を対応しておく。

①invoのapp/config/config.iniのbaseUriを「/」に変更しておく

②公開ディレクトリ直下にrouting.phpを作成する。

<?php
$route = parse_url(substr($_SERVER["REQUEST_URI"], 1))["path"];

if (is_file($route)) {
    if(substr($route, -4) == ".php"){
        require $route;         // Include requested script files
        exit;
    }
    return false;               // Serve file as is
} else {                        // Fallback to index.php
    $_GET["_url"] = "/" . $route;        // Try to emulate the behaviour of your htaccess here, if needed
    require "index.php";
}

 

で、おしまい。

 

routing.phpについては、phpの公式ページに書いてあるのを、

phalconようにちょろっと修正しただけです。

コメントがあればどうぞ


CAPTCHA Image
Reload Image