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


PHP app::start方法代码示例

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


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

示例1: run

 /**
  * Starts the application.
  * 
  * @return void
  */
 public static function run()
 {
     self::$starttime = microtime(true);
     error_reporting(config::ERROR_LEVEL);
     if (isset(config::$session_cookie_domain)) {
         ini_set('session.cookie_domain', config::$session_cookie_domain);
     }
     if (class_exists('formHelper')) {
         formHelper::fixArrays();
     }
     if (class_exists('csrfHelper')) {
         injector::register(array('csrfHelper', 'injector'));
     }
     if (is::ssl() && isset(config::$https_domain) && !isset(config::$http_domain)) {
         if (is::existset($_GET, 'r_domain')) {
             config::$http_domain = get::fulldomain($_GET['r_domain']);
         } else {
             config::$http_domain = get::fulldomain('www');
         }
     }
     session_start();
     if (config::$isolated_subdomains) {
         // find the domain
         $domain = isset(config::$http_domain) ? config::$http_domain : get::fulldomain();
         // kill any subdomain sessions that have been transfered to another subdomain
         $existing = array_keys($_SESSION);
         foreach ($existing as $d) {
             if (!is_array($_SESSION[$d])) {
                 continue;
             }
             if (array_key_exists('kill_munla_session', $_SESSION[$d]) && $_SESSION[$d]['kill_munla_session']) {
                 unset($_SESSION[$d]);
             }
         }
         // initialize and setup the session for this subdomain
         if (!array_key_exists($domain, $_SESSION)) {
             $_SESSION[$domain] = array();
         }
         munla::$session =& $_SESSION[$domain];
     } else {
         munla::$session =& $_SESSION;
     }
     if (class_exists('singleUseArray')) {
         if (!is::existset(munla::$session, 'MUNLA_SINGLE_USE')) {
             munla::$singleUse = new singleUseArray();
         } else {
             munla::$singleUse = unserialize(munla::$session['MUNLA_SINGLE_USE']);
         }
     }
     $route = get::route();
     if (is_array($route) && $route['controller'] == 'csrf' && $route['action'] == 'keepalive' && class_exists('csrfHelper') && is::existset($route, 'params') && count($route['params']) > 0) {
         if (isset($_POST['token'])) {
             echo csrfHelper::keepAlive($route['params'][0], $_POST['token']);
         }
         exit;
     }
     if (class_exists('user') && is_subclass_of('user', 'userBase')) {
         if (!is::existset(munla::$session, 'MUNLA_USER')) {
             munla::$session['MUNLA_USER'] = new userWrapper(new user());
         }
     }
     injector::start();
     if (class_exists('app') && is_callable(array('app', 'setup'))) {
         app::setup();
     }
     if (!isset(munla::$user) && is::existset(munla::$session, 'MUNLA_USER')) {
         munla::$user =& munla::$session['MUNLA_USER'];
     }
     if (!is::ajax()) {
         $submittedForm = formHelper::process();
         if (isset($submittedForm)) {
             formHelper::process($submittedForm);
         }
     }
     if (class_exists('app') && is_callable(array('app', 'start'))) {
         $route = app::start($route);
     }
     if ($route === null) {
         $route = array('controller' => 'index', 'action' => 'index', 'params' => null);
     }
     $controller = get::controller($route['controller']);
     if (!isset($controller) && $route['controller'] != 'index') {
         //push action to params, controller to action, and set controller to index and try again.
         if ($route['action'] != 'index') {
             if (!isset($route['params'])) {
                 $route['params'] = array();
             }
             array_unshift($route['params'], $route['action']);
         }
         $route['action'] = $route['controller'];
         $route['controller'] = 'index';
         $controller = get::controller('index');
     }
     $view = null;
     if (isset($controller)) {
//.........这里部分代码省略.........
开发者ID:Borvik,项目名称:Munla,代码行数:101,代码来源:munla.php

示例2: ago

    // Source: http://css-tricks.com/snippets/php/time-ago-function/
    function ago($time)
    {
        $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
        $lengths = array("60", "60", "24", "7", "4.35", "12", "10");
        $now = time();
        $difference = $now - $time;
        $tense = "ago";
        for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths) - 1; $j++) {
            $difference /= $lengths[$j];
        }
        $difference = round($difference);
        if ($difference != 1) {
            $periods[$j] .= "s";
        }
        return "{$difference} {$periods[$j]}";
    }
}
$app = new app();
$flag = isset($argv[1]) ? $argv[1] : '';
switch ($flag) {
    case 'info':
        $app->info();
        break;
    case 'logout':
        $app->modhash();
        break;
    default:
        $app->start();
        break;
}
开发者ID:ademirzanetti,项目名称:labs,代码行数:31,代码来源:saver_bot.php

示例3: define

define('VAR_PATH', ROOT . 'var' . DIRECTORY_SEPARATOR);
define('LIB_PATH', '/data/git/mvc/app/system/');
define('VIEW_PATH', APP_PATH . 'view' . DIRECTORY_SEPARATOR);
define('MODEL_PATH', APP_PATH . 'model' . DIRECTORY_SEPARATOR);
define('CONTROLLER_PATH', APP_PATH . 'controller' . DIRECTORY_SEPARATOR);
require LIB_PATH . 'core.php';
if (DEBUG) {
    define('DB_DSN', 'mysql:host=172.168.1.3;port=13306;dbname=test1;charset=utf8');
    define('DB_USER', 'work');
    define('DB_PASS', '123456');
    base::url('//127.0.0.1:8088');
} else {
    define('DB_DSN', 'mysql:unix_socket=/var/run/mysql.sock;dbname=blog;charset=utf8');
    define('DB_USER', 'root');
    define('DB_PASS', 'root');
    base::url('//static-files.coding.io');
}
// 开启如下配置可使用sendMail
// define('MAIL_SERVER','smtp.126.com');
// define('MAIL_USERNAME','suconghou@126.com');
// define('MAIL_PASSWORD','123456');
// define('MAIL_NAME','发送者名称');
/*************************************应用程序配置区*************************************/
app::route('\\/([\\w\\-]{2,20})\\/([\\w\\-]{2,32})\\.(png|css|json|less)', array('sprite', 'index'));
app::route('\\/?', array('sprite', 'site'));
base::version(1234);
base::project('sprite');
/*************************************应用程序配置区*************************************/
//配置完,可以启动啦!
app::start();
开发者ID:suconghou,项目名称:sprite,代码行数:30,代码来源:index.php


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