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


PHP Autoload::init方法代码示例

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


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

示例1: init

 public static function init()
 {
     if (!self::$app) {
         $config = Autoload::load('App\\config');
         self::$app = new self($config);
         Autoload::init();
         $modules = self::app()->getConfig('Modules');
         foreach ($modules as $item) {
             $module = 'Modules/' . $item;
             Autoload::load($module, 1);
         }
         Session::init();
         Router::init();
     }
 }
开发者ID:serj1chen,项目名称:torrent_uawebchallenge,代码行数:15,代码来源:Application.php

示例2: dirname

#!/usr/bin/php
<?php 
include dirname(__DIR__) . '/framework/init.php';
Autoload::init(array(LIBS, EXTERNAL, FRAMEWORK_LIBS, FRAMEWORK_EXTERNAL), CACHE);
Config::parse('define.ini', true);
Cache::$base_prefix = Config::get('cache', 'prefix');
function clear_dir($dir)
{
    if (!file_exists($dir)) {
        return;
    }
    foreach (glob($dir . '/*') as $file) {
        unlink($file);
    }
}
$file = array_shift($argv);
$set = array_shift($argv);
if (empty($set)) {
    die('Set needed' . "\n");
}
$set = Database::get_full_row('set', 'id = ?', $set);
if (empty($set)) {
    die('Incorrect set' . "\n");
}
if (!$set['grabbed']) {
    Grabber::get_set($set['id']);
}
$folder = IMAGES . SL . 'import';
if (!file_exists($folder . SL . $set['id']) || !is_dir($folder . SL . $set['id'])) {
    die('No import folder' . "\n");
}
开发者ID:4otaku,项目名称:draft,代码行数:31,代码来源:import_pics.php

示例3: self

        if (!self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }
    /**
     * Registrar.
     *
     * @return void
     */
    public function register()
    {
        spl_autoload_register(function ($name) {
            // fix root
            if ($name[0] != '\\') {
                $name = '\\' . $name;
            }
            // only couch files
            if (1 !== strpos($name, __NAMESPACE__)) {
                return;
            }
            // prepare file name & path
            $name = substr($name, 1 + strlen(__NAMESPACE__));
            $file = sprintf('%s/%s.php', __DIR__, str_replace('\\', '/', $name));
            require $file;
        });
    }
}
// auto-init for including
return Autoload::init();
开发者ID:yay-couch,项目名称:couch,代码行数:30,代码来源:Autoload.php

示例4: catch

<?php

require_once 'engine/utils.php';
require_once 'engine/autoload.php';
Autoload::init('config/autoload.php');
use App\Config, App\Request, App\User, App\Route, App\View, App\Timer, App\Debug, App\Mysql, App\Response;
try {
    Config::load('config/settings.php');
    Config::applyHostSettings('config/hosts.php');
    Mysql::setHost(Config::get('dbConnection'));
    Timer::start();
    User::startSession();
    Request::parse();
    Route::add(['/dumper' => 'dumper', '/module' => 'module', '/login' => 'login', '/tasks' => 'page', '/profile' => 'page', '/projects' => 'page', '/workspace' => 'page', '/404' => 'error', '/' => 'page']);
    Route::go();
    Timer::showExecutionTime();
    Mysql::showResources();
    Response::out();
} catch (\Exception $e) {
    Debug::showException($e);
}
开发者ID:smith46102,项目名称:koda,代码行数:21,代码来源:index.php

示例5: Router

<?php

// Require Loader
if (file_exists("app/libraries/Autoload.php")) {
    require_once "app/libraries/Autoload.php";
}
// Initialize all requires classes
Autoload::init();
// To avoid triggering a PHP notice, we can't use array elements that do not exists
if (!isset($_GET['url'])) {
    $_GET['url'] = '/';
}
$router = new Router($_GET['url']);
$router->setDefaultController('HomeController');
$router->setDefaultAction('index');
$router->parse();
$controller = $router->getController();
$action = $router->getAction();
$arguments = $router->getArguments();
$controllerClass = Controller::factory($controller);
$actionName = $action;
// This is the key part, we call a method that has a name stored in $stored
$controllerClass->{$actionName}($arguments);
开发者ID:joaomlap,项目名称:simple-secure-mvc,代码行数:23,代码来源:index.php

示例6: search_lib

            include_once $library;
            return true;
        }
        return false;
    }
    protected static function search_lib($name)
    {
        foreach (self::$directories as $directory) {
            if (file_exists($directory . SL . $name)) {
                return $directory . SL . $name;
            }
        }
        return false;
    }
}
Autoload::init(array(ROOT_DIR . SL . 'libs', ENGINE . SL . 'external'));
function autoload_old($class_name)
{
    $class = ROOT_DIR . SL . 'libs' . SL . str_replace('__', SL, $class_name) . '.php';
    if (file_exists($class)) {
        include_once $class;
        return true;
    }
    $class = ROOT_DIR . SL . 'engine' . SL . str_replace('__', SL, $class_name) . '.php';
    if (file_exists($class)) {
        include_once $class;
        return true;
    }
    if (!preg_match('/^Read_/i', $class_name) && !preg_match('/^Api_/i', $class_name)) {
        if (_TYPE_ == 'index') {
            include_once TEMPLATE_DIR . SL . '404' . SL . 'fatal.php';
开发者ID:4otaku,项目名称:4otaku,代码行数:31,代码来源:autoloader.php

示例7:

<?php

/// logic unrelated to a specific request
/** @file */
#Tool, used by config
require_once $_ENV['systemFolder'] . 'tool/Tool.php';
#used by autoloader
require_once $_ENV['systemFolder'] . 'tool/Arrays.php';
require_once $_ENV['systemFolder'] . 'tool/Hook.php';
require_once $_ENV['systemFolder'] . 'tool/CommonTraits.php';
#Config setting
require_once $_ENV['systemFolder'] . 'tool/Config.php';
Config::init();
#Autoloader
require_once $_ENV['systemFolder'] . 'tool/Autoload.php';
$autoload = Autoload::init(null, $_ENV['autoloadIncludes']);
spl_autoload_register(array($autoload, 'auto'));
#composer autload
if (is_file($_ENV['composerFolder'] . 'autoload.php')) {
    require_once $_ENV['composerFolder'] . 'autoload.php';
}
set_error_handler($_ENV['errorHandler'], $_ENV['errorsHandled']);
set_exception_handler($_ENV['exceptionHandler']);
Config::loadUserFiles($_ENV['preRoute']);
#pre session request handling; for file serving and such.
require_once $_ENV['systemFolder'] . 'tool/control/Route.php';
\control\Route::handle($_SERVER['REQUEST_URI']);
开发者ID:jstacoder,项目名称:brushfire,代码行数:27,代码来源:loader.php


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