当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::init方法代码示例

本文整理汇总了PHP中Application::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::init方法的具体用法?PHP Application::init怎么用?PHP Application::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Application的用法示例。


在下文中一共展示了Application::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 static function run()
 {
     if (!self::$init) {
         self::$init = true;
         self::init();
     }
     $route = Router::dispatch();
     if (!empty($route)) {
         if (is_callable($route['callback'])) {
             call_user_func_array($route['callback'], $route['params']);
         } else {
             if (strpos($route['callback'], '@') !== false) {
                 $pieces = explode('@', $route['callback']);
                 $route['action'] = $pieces[1];
                 $route['controller'] = $pieces[0];
             } else {
                 $route['action'] = 'index';
                 $route['controller'] = $route['callback'];
             }
             self::loadRoute($route);
         }
     } else {
         call_user_func(self::$error404);
     }
 }
开发者ID:vitodtagliente,项目名称:webseed,代码行数:25,代码来源:Application.php

示例2: __construct

 /**
  * 构造函数
  *
  * @access public
  * @param String $ini
  * @return void
  */
 private function __construct($ini)
 {
     require_once __DIR__ . '/application.php';
     Application::init($ini);
     $this->config = \Myfox\Lib\Config::instance('default');
     $this->prefix = rtrim($this->config->get('url.prefix', ''), '/');
     $logurl = $this->config->get('log/default');
     if (empty($logurl)) {
         $this->log = new \Myfox\Lib\BlackHole();
     } else {
         $this->log = new \Myfox\Lib\Log($logurl);
     }
 }
开发者ID:ray-dong,项目名称:Myfox-load-module,代码行数:20,代码来源:dispatcher.php

示例3: __construct

 /**
  * 构造函数
  *
  * @access private
  * @return void
  */
 private function __construct($ini, $class, $option = null)
 {
     require_once __DIR__ . '/application.php';
     Application::init($ini);
     $worker = sprintf(__NAMESPACE__ . '\\worker\\%s', ucfirst(strtolower($class)));
     $this->worker = new $worker((array) $option);
     if (!$this->worker instanceof \Myfox\App\Worker) {
         printf("Class \"%s\" is not a subclass extended from \"Worker\".\n", $worker);
         exit;
     }
     $config = new \Myfox\Lib\Config($ini);
     self::$runmode = strtolower(trim($config->get('run.mode', 'online')));
     self::$identy = sprintf('%d@%s', getmypid(), strtolower(trim(php_uname('n'))));
     $_clone =& $this;
     $this->sigaction(SIGTERM, function ($signal) use($_clone) {
         printf("[%s]\tGot signal (%d)", date('Y-m-d H:i:s'), $signal);
         if (SIGTERM == $signal) {
             echo ", about to terminal ...\n";
             $_clone->freelock();
             exit(0);
         }
     });
 }
开发者ID:sdgdsffdsfff,项目名称:Myfox-load-module,代码行数:29,代码来源:daemon.php

示例4: activate

 static function activate(Application $application)
 {
     $application->init();
     self::$runningApplication = $application;
 }
开发者ID:nmcteam,项目名称:recess,代码行数:5,代码来源:Application.class.php

示例5: array

define('APPLICATION_ENTRY_POINT', true);
// http://php.net/manual/en/security.magicquotes.disabling.php
if (get_magic_quotes_gpc()) {
    $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    while (list($key, $val) = each($process)) {
        foreach ($val as $k => $v) {
            unset($process[$key][$k]);
            if (is_array($v)) {
                $process[$key][stripslashes($k)] = $v;
                $process[] =& $process[$key][stripslashes($k)];
            } else {
                $process[$key][stripslashes($k)] = stripslashes($v);
            }
        }
    }
    unset($process);
}
if (!isset($action)) {
    if (!isset($_REQUEST['action'])) {
        $action = 'index';
    } else {
        $action = $_REQUEST['action'];
    }
}
require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/core/Application.php';
$application = new Application();
$application->init($applicationConfig, $action, $_REQUEST);
$application->run();
$application->send();
exit;
开发者ID:tanya61612,项目名称:Pastexen,代码行数:31,代码来源:index.php

示例6: define

<?php

/**
 * Spiral Framework, SpiralScout LLC.
 *
 * @package   spiralFramework
 * @author    Anton Titov (Wolfy-J)
 * @copyright ©2009-2011
 */
define('SPIRAL_INITIAL_TIME', microtime(true));
//No comments
mb_internal_encoding('UTF-8');
//Error reporting
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', false);
//Root directory
$root = dirname(__DIR__) . '/';
//Composer
require $root . 'vendor/autoload.php';
//Forcing work directory
chdir($root);
//Let's start!
Application::init(['root' => $root, 'libraries' => $root . '/vendor/', 'application' => $root . '/application/'], true)->start();
开发者ID:jwdeitch,项目名称:Concessions,代码行数:23,代码来源:index.php

示例7:

<?php

require_once __DIR__ . '/../app/bootstrap.php';
Application::init();
开发者ID:dgilan,项目名称:test,代码行数:4,代码来源:index.php

示例8: array

<?php

class Application extends Gongo_App
{
    public $uses = array('root' => 'Skelton_Controller_Root');
}
$app = new Application(dirname(__FILE__));
$app->init()->run();
开发者ID:no22,项目名称:gongo,代码行数:8,代码来源:app.php

示例9: __construct

 /**
  * 构造函数
  *
  * @access private
  * @return void
  */
 private function __construct($ini, $class, $option = null)
 {
     require_once __DIR__ . '/application.php';
     Application::init($ini);
     $worker = sprintf(__NAMESPACE__ . '\\worker\\%s', ucfirst(strtolower($class)));
     $this->worker = new $worker((array) $option);
     if (!$this->worker instanceof \Myfox\App\Worker) {
         printf("Class \"%s\" is not a subclass extended from \"Worker\".\n", $worker);
         exit;
     }
 }
开发者ID:ray-dong,项目名称:Myfox-load-module,代码行数:17,代码来源:daemon.php

示例10: init

                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <h3>Zadanie 2</h3>
                    <p>Mamy plik xml zawierający listę seansów filmowych (tutaj).
                        Napisz program, który cyklicznie będzie zaczytywał dane z
                        plików z podanego źródła i zapisywał do bazy danych
                        (zaproponuj odpowiednią strukturę bazy). Informacje na
                        temat seansów w plikach mogą z biegiem czasu ulegać zmianie
                        i odpowiadające im dane powinny być aktualizowane w bazie.
                        Program powinien być w pełni przetestowany.</p>

                    <?php 
$app = new Application();
$app->init('http://nowetwarze.goingapp.pl/kina.xml');
$app->run();
class Application
{
    var $xml_file;
    public function init($xml_location)
    {
        $this->xml_file = file_get_contents(dirname(__FILE__) . '/kina.xml', FILE_USE_INCLUDE_PATH);
        //$xml_file = file_get_contents('http://nowetwarze.goingapp.pl/kina.xml', FALSE, stream_context_create( array( 'http' => array( 'user_agent' => 'php' ))));
        $db_connect = new Database();
        $db_connect->connect();
    }
    public function run()
    {
        $movies = simplexml_load_string($this->xml_file);
        if ($movies != '') {
开发者ID:ievgen11,项目名称:going_test_1,代码行数:31,代码来源:index.php

示例11: define

<?php

define('__ROOT__', dirname(__DIR__));
require_once __ROOT__ . '/vendor/autoload.php';
require_once __ROOT__ . '/app/config/bootstrap.php';
Application::init()->run();
开发者ID:jm-factorin,项目名称:bit-php,代码行数:6,代码来源:index.php

示例12: exists

    public $reason;
    public $contributions;
    public $dateline;
    public $avatar;
    /**
     * @param null $userid
     * @return static
     */
    public static function exists($userid = null)
    {
        if ($userid === null) {
            if (!TwitterAuth::isLogged()) {
                return null;
            } else {
                $userid = TwitterAuth::getUserId();
            }
        }
        return Application::findOne('userid = ?', [$userid]);
    }
    public function getVotes()
    {
        return ApplicationVote::find('applicationid = ?', [$this->applicationid]);
    }
    public function getScore()
    {
        $votes = $this->getVotes();
        return array_sum(Model::pluck($votes, 'vote'));
    }
}
Application::init('applications', 'applicationid');
开发者ID:xJakub,项目名称:LCE,代码行数:30,代码来源:Application.php

示例13: header

<?php

/**
 * Index
 * User: R2
 * Date: 05.09.12
 * Time: 23:49
 * To change this template use File | Settings | File Templates.
 */
header("Content-Type: charset=utf-8");
require_once "ComponentManager.php";
require_once "Application.php";
require_once "db.php";
require_once "models/Fetcher.php";
require_once "models/VoteFetcher.php";
require_once "models/AnswerFetcher.php";
require_once "models/QuestionsFetcher.php";
require_once "models/PollFetcher.php";
require_once "controller/Controller.php";
require_once "controller/PollController.php";
require_once "controller/AnswerController.php";
require_once "controller/VoteController.php";
require_once "controller/ErrorController.php";
require_once "controller/AdminPollController.php";
require_once "controller/AdminAnswerController.php";
Application::init(array('components' => array('fetchers' => array('class' => 'ComponentManager', '__construct' => array(array('components' => array('answers' => array('class' => 'AnswerFetcher'), 'poll' => array('class' => 'PollFetcher'), 'questions' => array('class' => 'QuestionsFetcher'), 'vote' => array('class' => 'VoteFetcher'))))), 'db' => array('class' => 'db', '__construct' => array('localhost', 'root', '', 'poll')))));
Application::getInstance()->run();
开发者ID:rail-rz,项目名称:framework,代码行数:27,代码来源:index.php

示例14: Application

 * and save a reference for it (for convenience)
 * @var Config_Simple $appConfig
 */
$appConfig = Config::factory(Config::Simple, 'main');
$appConfig->setData($config);
Registry::set('main', $appConfig, 'config');
/**
 * Convert the data of main_config file
 * in to the general form of configuration
 * and save a reference for it (for convenience)
 * @var Config_Simple $appConfig
 */
/*
 * Starting the application
 */
$app = new Application($appConfig);
$app->setAutoloader($autoloader);
$app->init();
//  build objects
$objectFiles = File::scanFiles($config['object_configs'], array('.php'), false, File::Files_Only);
foreach ($objectFiles as $file) {
    $object = substr(basename($file), 0, -4);
    echo 'build ' . $object . ' : ';
    $builder = new Db_Object_Builder($object);
    if ($builder->build()) {
        echo 'OK';
    } else {
        echo 'Error! ' . strip_tags(implode(', ', $builder->getErrors()));
    }
    echo "\n";
}
开发者ID:vgrish,项目名称:dvelum,代码行数:31,代码来源:bootstrap.php

示例15: function

<?php

$app = Application::init();
$app->route()->get('/', function () {
    $name = Request::get('name', 'jm-factorin');
    $user = UserService::createUserByName($name);
    return View::render('default.index', array('name' => $user->name));
});
开发者ID:jm-factorin,项目名称:bit-php,代码行数:8,代码来源:index.php


注:本文中的Application::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。