run() public method

Match routes against incoming URI
public run ( ) : mixed
return mixed
Beispiel #1
0
 /**
  * @test
  */
 public function testAssertNotZeroExitSuppressed()
 {
     // Command should yield an error
     $command = "exit 1";
     $this->_obj->expects($this->any())->method('getCommand')->will($this->returnValue($command));
     $this->_obj->setSuppressErrors(true);
     $this->_obj->run();
     $this->markTestIncomplete("Don't know how to check for the absence of a certain output regex");
 }
Beispiel #2
0
<?php

/**
 * 队列
 *
 *
 * 计划任务触发 by abc.com
 */
$_SERVER['argv'][1] = $_GET['act'];
@($_SERVER['argv'][2] = $_GET['op']);
if (empty($_SERVER['argv'][1])) {
    exit('Access Invalid!');
}
define('APP_ID', 'crontab');
define('BASE_PATH', str_replace('\\', '/', dirname(__FILE__)));
define('TRANS_MASTER', true);
if (!@(include dirname(dirname(__FILE__)) . '/global.php')) {
    exit('global.php isn\'t exists!');
}
if (!@(include BASE_CORE_PATH . '/33hao.php')) {
    exit('33hao.php isn\'t exists!');
}
if (PHP_SAPI == 'cli') {
    $_GET['act'] = $_SERVER['argv'][1];
    $_GET['op'] = empty($_SERVER['argv'][2]) ? 'index' : $_SERVER['argv'][2];
}
if (!@(include BASE_PATH . '/control/control.php')) {
    exit('control.php isn\'t exists!');
}
Base::run();
Beispiel #3
0
 public function run(array $context = [])
 {
     $this->logger->info('Press Home Key');
     return parent::run($context);
 }
Beispiel #4
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
$f3 = new Base();
//main page
$f3->route('GET /', function () {
    include 'main.php';
});
// Get the product lists
$f3->route('GET /example', function () {
    include 'example1.php';
});
//add a new product to all stores
$f3->route('GET|POST /new', function () {
    include 'newproducts.php';
});
//update the stock of a given product
$f3->route('GET|POST /products/*', function () {
    include 'update.php';
});
$f3->route('GET /brew/@count', function ($f3, $params) {
    echo $params['count'] . ' bottles of beer on the wall.';
});
$f3->run();
<?php

/* 
 * The MIT License
 *
 * Copyright 2016 Vincent Quatrevieux <*****@*****.**>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
require 'base/Base.php';
$app = new Base();
$app->run();