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


PHP Autoloader::directory方法代码示例

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


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

示例1: findDir

 /**
  * @param string $file Est le nom de la class sans son extension .class.php, qui doit être inclus
  * @return string
  */
 public static function findDir($file)
 {
     Autoloader::$directory = ['application', 'models', 'views', 'controllers'];
     foreach (Autoloader::$directory as $dir) {
         $extension = ".class.php";
         $path = realpath($dir . "/" . $file . $extension);
         if ($path) {
             return Autoloader::$pathClass = $path;
         }
     }
 }
开发者ID:yao-dev,项目名称:my-framework.github.io,代码行数:15,代码来源:Autoload.class.php

示例2: register

 /**
  * Registers own autoloader the SPL autoloader stack.
  * @param string $directory
  * @return boolean Returns true if registration was successful, false otherwise.
  */
 public static function register($directory)
 {
     self::$directory = $directory;
     // as spl_autoload_register() disables __autoload() and
     //  this behavior might be unwanted, we put it onto autoload stack
     if (function_exists('__autoload')) {
         spl_autoload_register('__autoload');
     }
     // Registers own loader function conforming
     // https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
     return spl_autoload_register(function ($className) {
         $className = ltrim($className, '\\');
         $fileName = '';
         $namespace = '';
         if ($lastNsPos = strripos($className, '\\')) {
             $namespace = substr($className, 0, $lastNsPos);
             $className = substr($className, $lastNsPos + 1);
             $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
         }
         $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
         require Autoloader::$directory . $fileName;
     });
 }
开发者ID:aichi,项目名称:URL-Shortener,代码行数:28,代码来源:Autoloader.php

示例3: date_default_timezone_set

date_default_timezone_set(Config::app('timezone', 'UTC'));
/*
 * Define the application error reporting level based on your environment
 */
switch (constant('ENV')) {
    case 'dev':
        ini_set('display_errors', true);
        error_reporting(-1);
        break;
    default:
        error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
}
/*
 * Set autoload directories to include your app models and libraries
 */
Autoloader::directory(array(APP . 'models', APP . 'libraries'));
/**
 * Helpers
 */
require APP . 'helpers' . EXT;
/**
 * Anchor setup
 */
Anchor::setup();
/**
 * Import defined routes
 */
if (is_admin()) {
    require APP . 'routes/admin' . EXT;
    require APP . 'routes/categories' . EXT;
    require APP . 'routes/comments' . EXT;
开发者ID:Rictus,项目名称:CMS_Prod,代码行数:31,代码来源:run.php

示例4: str_split

    $pool = str_split('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 1);
    $value = '';
    for ($i = 0; $i < $length; $i++) {
        $value .= $pool[mt_rand(0, 61)];
    }
    return $value;
}
/*
	Include some files.
*/
require PATH . 'system/classes/autoload.php';
require PATH . 'system/classes/helpers.php';
// map classes
Autoloader::map(array('Schema' => PATH . 'upgrade/classes/schema.php', 'Migrations' => PATH . 'upgrade/classes/migrations.php'));
// tell the autoloader where to find classes
Autoloader::directory(array(PATH . 'system/classes/'));
// register the auto loader
Autoloader::register();
/**
	Report all errors let our error class decide which to display
*/
error_reporting(-1);
/**
	Error display will be handled by our error class
*/
ini_safe_set('display_errors', false);
// Register the default timezone for the application.
date_default_timezone_set(Config::get('application.timezone'));
// Register the PHP exception handler.
set_exception_handler(array('Error', 'exception'));
// Register the PHP error handler.
开发者ID:reqshark,项目名称:anchor-cms,代码行数:31,代码来源:run.php

示例5: array

}
/**
	Magic Quotes Fix
	note: magic quotes is deprecated in PHP 5.3
	src: php.net/manual/en/security.magicquotes.disabling.php
*/
if (magic_quotes()) {
    $magics = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    foreach ($magics as &$magic) {
        $magic = array_strip_slashes($magic);
    }
}
// get our autoloader
require PATH . 'system/core/autoload.php';
// tell the autoloader where to find classes
Autoloader::directory(array(PATH . 'system/core/', PATH . 'system/library/'));
// register the auto loader
Autoloader::register();
/**
	Report all errors let our error class decide which to display
*/
error_reporting(-1);
/**
	Error display will be handled by our error class
*/
ini_safe_set('display_errors', false);
/**
	Check our installation
*/
if (Config::load(PATH . 'config.php') === false) {
    // looks like we are missing a config file
开发者ID:nathggns,项目名称:anchor-cms,代码行数:31,代码来源:bootstrap.php

示例6: date_default_timezone_set

date_default_timezone_set(Config::app('timezone', 'UTC'));
/*
 * Define the application error reporting level based on your environment
 */
switch (constant('ENV')) {
    case 'dev':
        ini_set('display_errors', true);
        error_reporting(-1);
        break;
    default:
        error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
}
/*
 * Set autoload directories to include your app models and libraries
 */
Autoloader::directory(array(APP . 'models', APP . 'libraries', PATH . 'anchor/libraries'));
/**
 * Set the current uri from get
 */
if ($route = Arr::get($_GET, 'route', '/')) {
    Uri::$current = trim($route, '/') ?: '/';
}
/*
	Helper functions
*/
function timezones()
{
    $list = DateTimeZone::listIdentifiers();
    $data = array();
    foreach ($list as $id => $zone) {
        $now = new DateTime(null, new DateTimeZone($zone));
开发者ID:hackiosa,项目名称:anchor-cms,代码行数:31,代码来源:run.php


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