Rack::add PHP Method

add() public static method

public static add ( $name, $file = null )
    public static function add($name, $file = null)
    {
        if (!self::$ob_started) {
            self::init();
        }
        if (!self::$constructed) {
            self::$middleware[$name] = true;
            self::require_file($file);
            return true;
        }
        return false;
    }

Usage Example

コード例 #1
0
ファイル: rackup.php プロジェクト: jimeh/php-rack
<?php

define("ROOT", dirname(dirname(__FILE__)));
require ROOT . "/lib/rack.php";
// add some middlewares
Rack::add("Format", ROOT . "/app/format.php");
Rack::add("App", ROOT . "/app/app.php");
// insert the Api middleware before App
Rack::insert_before("App", "Api", ROOT . "/app/api.php");
Rack::run();