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


PHP Autoloader::init方法代码示例

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


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

示例1: initAutoloader

 private function initAutoloader($rootPath)
 {
     // It is ugly to include the classes here inside the function, but
     // otherwise we would have to use another hardcoded path.
     require_once $rootPath . DIRECTORY_SEPARATOR . Constants::CLASSES_DIR . DIRECTORY_SEPARATOR . 'PathBuilder.php';
     $pathBuilder = PathBuilder::getInstance();
     $pathBuilder->setRootPath($rootPath);
     require_once $pathBuilder->buildAbsolutePath(Constants::CLASSES_DIR, 'Autoloader.php');
     Autoloader::init();
 }
开发者ID:klickverbot,项目名称:theBlackboard,代码行数:10,代码来源:Core.php

示例2: run

 public static function run()
 {
     Autoloader::init();
     $session = SessionFactory::create();
     $session->setTime('864000');
     //24 hs
     $session->start();
     $requestHandler = RequestHandlerFactory::create();
     $requestHandler->handle($_REQUEST);
 }
开发者ID:argosback,项目名称:statistical-log-analizer,代码行数:10,代码来源:Application.php

示例3: run

 /**
  * 运行一个请求生命周期
  * @access public
  * @author songdengtao <http://www.songdengtao.cn>
  * @return void
  */
 public static function run()
 {
     // 系统注册表
     Registry::init(static::get('registryPath'));
     // 运行环境检查
     static::checkEnv();
     // 类文件自动加载
     Autoloader::init(static::getInstance());
     Autoloader::autoload();
     // 设置系统时区
     static::shell('Dtime::setDateDefaultTimeZone');
     // 设置错误处理方法
     static::shell('Error::registerShutdownFunction');
     static::shell('Error::setErrorHandler');
     // 设置异常处理方法
     static::shell('Exception::setExceptionHandler');
     if (false === static::get('isCli')) {
         static::shell('Filter::globalFilter');
         static::shell('Session::start');
     }
     // 路由
     static::shell('Router::dispatch');
     $controller = CONTROLLER_NAME . 'Controller';
     $action = ACTION_NAME . 'Action';
     $class = CONTROLLER_NAMESPACE . '\\' . $controller;
     if (!class_exists($class)) {
         $class = CONTROLLER_NAMESPACE . '\\EmptyController';
         if (!class_exists($class)) {
             $module = strstr(CONTROLLER_NAMESPACE, '\\', true);
             if (static::get('debug')) {
                 if (!is_dir(static::get('appPath') . $module)) {
                     static::shell('Error::halt', 'Call to undefined module ' . $module);
                 } else {
                     static::shell('Error::halt', 'Call to undefined controller ' . $class);
                 }
             } else {
                 static::shell('Error::halt', '404 Not found');
             }
         }
     }
     (new $class())->{$action}();
     return;
 }
开发者ID:songdent,项目名称:pandaphp,代码行数:49,代码来源:Pandaphp.php

示例4: includeFunctions

function includeFunctions($dirname)
{
    $dirhandle = opendir($dirname);
    while (false !== ($filename = readdir($dirhandle))) {
        if ($filename != '.' && $filename != '..' && $filename != '') {
            if ((substr($filename, 0, 9) == 'function.' || substr($filename, 0, 9) == 'constant.') && substr($filename, -4) == '.php') {
                include $dirname . $filename;
            }
            if (is_dir($dirname . $filename)) {
                includeFunctions($dirname . $filename . '/');
            }
        }
    }
    closedir($dirhandle);
}
Autoloader::init();
/**
 * Class Autoloader
 *
 * iterates through given directory and includes
 * the file which matches $classname
 *
 * @copyright  (c) the authors
 * @author     Froxlor team <team@froxlor.org> (2013-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Autoloader
 * @since      0.9.29.1
 */
class Autoloader
{
    /**
开发者ID:asemen,项目名称:Froxlor,代码行数:31,代码来源:functions.php

示例5: init

<?php

class Autoloader
{
    private static $basepath;
    public static function init($basepath)
    {
        self::$basepath = $basepath;
        spl_autoload_register('Autoloader::loader');
    }
    public static function loader($className)
    {
        if (strpos($className, 'connected') !== false) {
            $fileName = self::$basepath . '/' . str_replace("\\", "/", str_replace("connected\\", "", $className)) . ".php";
            if (file_exists($fileName)) {
                require_once $fileName;
                if (class_exists($className)) {
                    return true;
                }
            }
        }
        return false;
    }
}
Autoloader::init(dirname(__FILE__));
开发者ID:madal3x,项目名称:evso,代码行数:25,代码来源:Autoloader.php

示例6: Autoloader

<?php

namespace Redaxscript;

/* autoload */
include_once 'includes/Autoloader.php';
include_once 'TestCaseAbstract.php';
/* deprecated */
include_once 'includes/query.php';
/* init */
$autoloader = new Autoloader();
$autoloader->init();
/* get instance */
$registry = Registry::getInstance();
$config = Config::getInstance();
/* config */
$dbUrl = getenv('DB_URL');
if ($dbUrl) {
    $config->parse($dbUrl);
} else {
    $config->set('dbType', 'sqlite');
    $config->set('dbHost', ':memory:');
}
/* database */
Db::construct($config);
Db::init();
/* installer */
$installer = new Installer($config);
$installer->init();
$installer->rawDrop();
$installer->rawCreate();
开发者ID:redaxmedia,项目名称:redaxscript,代码行数:31,代码来源:bootstrap.php

示例7: define

<?php

/**
 *
 * This file is part of the Apix Project.
 *
 * (c) Franck Cassedanne <franck at ouarz.net>
 *
 * @license     http://opensource.org/licenses/BSD-3-Clause  New BSD License
 *
 */
namespace Apix;

define('UNIT_TEST', true);
define('APP_TOPDIR', realpath(__DIR__ . '/../php'));
define('APP_TESTDIR', realpath(__DIR__));
define('APP_VENDOR', realpath(__DIR__ . '/../../vendor'));
// @TODO: this won't work with PEAR
require APP_VENDOR . '/apix/autoloader/src/php/Apix/Autoloader.php';
Autoloader::init(array(APP_TOPDIR, APP_TESTDIR, APP_VENDOR));
开发者ID:vidyatestghe,项目名称:apix-cache,代码行数:20,代码来源:bootstrap.php

示例8: array

<?php

//C:\wamp\bin\php\php5.5.12\php.exe
require 'engine/autoloader.php';
$avtoloader = Autoloader::init();
$paths = array('app/libs', 'app/controllers');
$avtoloader->load($paths);
///
require 'vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$socket = new React\Socket\Server($loop);
$http = new React\Http\Server($socket);
///
$queue = new queueHandler();
///
$http->on('request', function ($request, $response) {
    $answer = 'void';
    $query = $request->getQuery();
    $path = $request->getPath();
    $dispatcher = Dispatcher::getInstance();
    $answer = $dispatcher->run($query, $path);
    if (isset($query['param'])) {
        if ($query['param'] == 'time') {
            $answer = microtime(true);
        }
        if ($query['param'] == 'die') {
            echo 'Die';
            exit;
        }
    }
    $response->writeHead(200, array('Content-Type' => 'text/plain'));
开发者ID:valentinkh1,项目名称:mcdaemon,代码行数:31,代码来源:index.php

示例9: testLoad

 /**
  * @covers Microsite\Autoloader::load
  * @covers Microsite\Autoloader::register
  * @covers Microsite\Autoloader::init
  */
 public function testLoad()
 {
     Autoloader::init();
     Autoloader::register('Testing', BOOTSTRAP_DIR . '/data');
     $this->assertTrue(\Testing\TestClass::get_true());
 }
开发者ID:ringmaster,项目名称:microsite2,代码行数:11,代码来源:AutoloaderTest.php

示例10: error_reporting

<?php

include_once 'classes/Config.php';
include_once 'classes/Autoloader.php';
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
Autoloader::init(Config::get('fulldir'));
setlocale(LC_ALL, "es_ES");
date_default_timezone_set("Europe/Madrid");
session_start();
开发者ID:AugustoAngeletti,项目名称:erepublik,代码行数:10,代码来源:bootstrap.php


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