本文整理汇总了PHP中Flight::path方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::path方法的具体用法?PHP Flight::path怎么用?PHP Flight::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flight
的用法示例。
在下文中一共展示了Flight::path方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRegister
function testRegister()
{
Flight::path(__DIR__ . '/classes');
Flight::register('test', 'TestClass');
$test = Flight::test();
$loaders = spl_autoload_functions();
$this->assertTrue(sizeof($loaders) > 0);
$this->assertTrue(is_object($test));
$this->assertEquals('TestClass', get_class($test));
}
示例2: testRegister
function testRegister()
{
Flight::path(__DIR__ . '/classes');
Flight::register('user', 'User');
$user = Flight::user();
$loaders = spl_autoload_functions();
$this->assertTrue(sizeof($loaders) > 0);
$this->assertTrue(is_object($user));
$this->assertEquals('User', get_class($user));
}
示例3: date_default_timezone_set
<?php
date_default_timezone_set('America/New_York');
require_once 'flight/Flight.php';
require_once 'vendor/github/GitHubClient.php';
// Autoload models and controllers
Flight::path('models');
Flight::path('controllers');
Flight::path('models/division_structures');
// Set views path and environment
Flight::set('flight.views.path', 'views');
Flight::set('root_dir', dirname(__FILE__));
Flight::set('base_url', '/Division-Tracker/');
// Set database credentials
define('DB_HOST', '');
define('DB_USER', '');
define('DB_PASS', '');
define('ARCH_PASS', '');
Flight::register('aod', 'Database', array('aod'));
// defines for website URLs
define('CLANAOD', 'http://www.clanaod.net/forums/member.php?u=');
define('BATTLELOG', 'http://battlelog.battlefield.com/bfh/agent/');
define('BATTLEREPORT', 'http://battlelog.battlefield.com/bf4/battlereport/show/1/');
define('BF4DB', 'http://bf4db.com/players/');
define('PRIVMSG', 'http://www.clanaod.net/forums/private.php?do=newpm&u=');
define('EMAIL', 'http://www.clanaod.net/forums/sendmessage.php?do=mailmember&u=');
define('REMOVE', 'http://www.clanaod.net/forums/modcp/aodmember.php?do=remaod&u=');
// defines for BF4 division activity status display
define('PERCENTAGE_CUTOFF_GREEN', 75);
define('PERCENTAGE_CUTOFF_AMBER', 50);
define('INACTIVE_MIN', 0);
示例4: ini_set
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
require '../flight/Flight.php';
Flight::path(__DIR__ . '/src');
Flight::path(__DIR__ . '/../src');
Flight::route('/', function () {
echo 'hello world!operation';
});
Flight::route('POST /test/', function () {
$t = new operation\src\PackageOperation();
$t->test();
});
Flight::route('POST /install/', function () {
$t = new operation\src\PackageOperation();
$t->install();
});
Flight::route('POST /update/', function () {
$t = new operation\src\PackageOperation();
$t->update();
});
Flight::route('POST /rollback/', function () {
$t = new operation\src\PackageOperation();
$t->rollback();
});
Flight::route('POST /maintenance/', function () {
$t = new operation\src\PackageOperation();
$t->maintenance();
});
Flight::route('GET /get_task_result/', function () {
示例5: define
<?php
define("START_TIME", microtime());
define("APP_PATH", __DIR__ . "/../app");
require __DIR__ . "/../vendor/autoload.php";
Flight::set(require APP_PATH . "/config/app.php");
Flight::path(Flight::get("flight.controllers.path"));
Flight::path(Flight::get("flight.models.path"));
Flight::path(Flight::get("flight.libs.path"));
示例6: array
Flight::register('view', 'Twig_Environment', array($loader, $twigConfig), function ($twig) {
$twig->addExtension(new Twig_Extension_Debug());
// Add the debug extension
});
/**
* Initiate ActiveRecord
*/
ActiveRecord\Config::initialize(function ($cfg) {
$cfg->set_model_directory('./models');
$cfg->set_connections(array('development' => 'mysql://root:root@localhost/test'));
$cfg->set_default_connection('development');
});
/**
* Add /controllers to the include-path
*/
Flight::path(dirname(__FILE__) . '/controllers');
Flight::route('/', array('IndexController', 'index'));
Flight::route('/test', function () {
echo "hello!";
});
Flight::route('/test-user', function () {
$user = new User();
$user->firstname = 'Marcus';
$user->surname = 'Olsson';
$user->email = 'trash@dumpster.com';
$user->save();
print_r(User::last());
});
Flight::route('/hello', function () {
$data = array('name' => Flight::request()->query->name);
Flight::view()->display('template.html', $data);
示例7: function
<?php
Flight::path("model/");
Flight::path("controller/");
Flight::register('db', 'mysqli', [$config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['databasename']]);
Flight::register("util", "util");
Flight::register("auth", "authController");
Flight::register("posts", "postController");
Flight::register("users", "userController");
Flight::set("flight.base_url", $config['web']['base_url']);
Flight::map('link', function ($url) {
echo Flight::get('flight.base_url') . $url;
});
示例8: date_default_timezone_set
<?php
date_default_timezone_set('America/New_York');
require_once 'flight/Flight.php';
require_once 'vendor/github/GitHubClient.php';
// Autoload models and controllers
Flight::path('models');
Flight::path('controllers');
// Set views path and environment
Flight::set('flight.views.path', 'views');
Flight::set('root_dir', dirname(__FILE__));
Flight::set('base_url', '/Division-Tracker/');
// Set database credentials
define('DB_HOST', '');
define('DB_USER', '');
define('DB_PASS', '');
define('ARCH_PASS', '');
Flight::register('aod', 'Database', array('aod'));
// defines for website URLs
define('CLANAOD', 'http://www.clanaod.net/forums/member.php?u=');
define('BATTLELOG', 'http://battlelog.battlefield.com/bfh/agent/');
define('BATTLEREPORT', 'http://battlelog.battlefield.com/bf4/battlereport/show/1/');
define('BF4DB', 'http://bf4db.com/players/');
define('PRIVMSG', 'http://www.clanaod.net/forums/private.php?do=newpm&u=');
define('EMAIL', 'http://www.clanaod.net/forums/sendmessage.php?do=mailmember&u=');
define('REMOVE', 'http://www.clanaod.net/forums/modcp/aodmember.php?do=remaod&u=');
// defines for BF4 division activity status display
define('PERCENTAGE_CUTOFF_GREEN', 75);
define('PERCENTAGE_CUTOFF_AMBER', 50);
define('INACTIVE_MIN', 0);
define('INACTIVE_MAX', 25);
示例9: PDO
<?php
\Flight::set('flight.views.path', __DIR__ . '/../views');
\Flight::path(__DIR__ . '/../controllers');
$connection = new PDO('mysql:host=localhost;dbname=tbzsn', 'root', '');
$db = new \ClanCats\Hydrahon\Builder('mysql', function ($query, $queryString, $queryParameters) use($connection) {
$statement = $connection->prepare($queryString);
$statement->execute($queryParameters);
if ($query instanceof \ClanCats\Hydrahon\Query\Sql\Select) {
return $statement->fetchAll(\PDO::FETCH_ASSOC);
}
});
echo $db->table('users')->select('username')->count();
示例10: dirname
<?php
/**
* Include and set up FlightPHP
*/
$dir = dirname(__FILE__);
if (!class_exists('Flight')) {
require $dir . '/flight/flight/Flight.php';
// path for classes
Flight::path($dir . '/classes');
// set the path for view files
Flight::set('flight.views.path', $dir . '/views');
}
示例11: function
<?php
Flight::path("controllers/");
Flight::path("classes/");
Flight::register('db', 'mysqli', [$config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['databasename']]);
Flight::register('auth', 'auth');
Flight::register('util', 'util');
Flight::register('absence', 'absenceController');
Flight::register('events', 'eventController');
Flight::register('players', 'playerController');
Flight::register('teams', 'teamController');
Flight::register('users', 'userController');
Flight::set("flight.base_url", $config['web']['base_url']);
Flight::map('link', function ($url) {
echo Flight::get('flight.base_url') . $url;
});
Flight::map('noAccess', function () {
Flight::util()->render('noAccess');
die;
});
Flight::map('notFound', function () {
Flight::util()->render('404');
die;
});
Flight::map('notLogedIn', function () {
Flight::util()->render('notLogedIn');
die;
});
示例12: dirname
<?php
/**
* @package ArtMoi Wordpress Plugin
* @version 1.0
*/
/*
Plugin Name: ArtMoi Wordpress Plugin
Description: Plugin for syncing your ArtMoi account with Wordpress Media Files
Version: 1.0
Author URI: http://artmoi.com
*/
// Require flight
require dirname(__FILE__) . '/vendor/flight/flight/Flight.php';
// Set the search path for flight registered classes
Flight::path(dirname(__FILE__) . '/classes');
// Set the view folder for flight
Flight::set('flight.views.path', dirname(__FILE__) . '/views');
// Register classes with flight
Flight::register('artmoi', 'Artmoi_Request');
Flight::register('response', 'Artmoi_response');
Flight::register('controller', 'Artmoi_Controller');
Flight::register('item', 'Artmoi_Item');
class ArtMoi_WP
{
/**
* constructor
*/
public function __construct()
{
// Load admin menu and pages
示例13: define
<?php
define('START_TIME', microtime());
define('APP_PATH', __DIR__ . '/../app');
require __DIR__ . '/../vendor/autoload.php';
//include helpers.php
require APP_PATH . '/core/helpers.php';
//Load Dotenv
$dotenv = new Dotenv\Dotenv(__DIR__ . '/../');
$dotenv->load();
Flight::set(require APP_PATH . '/config/app.php');
//setting url case_sensitive, default false
Flight::set('flight.case_sensitive', true);
/*-----
Flight autoload start
-----*/
//controllers
Flight::path(Flight::get('flight.controllers.path'));
//models
Flight::path(Flight::get('flight.models.path'));
//core
Flight::path(Flight::get('flight.core.path'));
/*-----
Flight autoload end
-----*/