本文整理汇总了PHP中Autoloader::addClassPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Autoloader::addClassPath方法的具体用法?PHP Autoloader::addClassPath怎么用?PHP Autoloader::addClassPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Autoloader
的用法示例。
在下文中一共展示了Autoloader::addClassPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$this->cacheFile = dirname(__FILE__) . 'class_path_cache.txt';
$this->removeCacheFile();
include_once dirname(dirname(dirname(__FILE__))) . '/extras/Autoloader.class.php';
Autoloader::addClassPath(dirname(__FILE__) . '/classes_app/');
Autoloader::addClassPath(dirname(__FILE__) . '/classes_shared/');
Autoloader::setCacheFilePath($this->cacheFile);
//Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\..*$/');
spl_autoload_register(array('Autoloader', 'loadClass'));
}
示例2: setDirectory
function setDirectory($dir)
{
$this->directory = $dir;
Autoloader::addClassPath(DIR . $dir . '/');
}
示例3: array
*
* <code>
* include_once('coughphp/extras/Autoloader.class.php');
* Autoloader::addClassPath('app_path/classes/');
* Autoloader::addClassPath('shared_path/classes/');
* Autoloader::setCacheFilePath('app_path/tmp/class_path_cache.txt');
* Autoloader::excludeFolderNamesMatchingRegex('/^CVS|\..*$/');
* spl_autoload_register(array('Autoloader', 'loadClass'));
* </code>
*
* @package default
* @author Anthony Bush, Wayne Wight
* @copyright 2006-2008 Academic Superstore. This software is open source protected by the FreeBSD License.
* @version 2008-09-22
**/
Autoloader::addClassPath(DIR . 'library/');
spl_autoload_register(array('Autoloader', 'loadClass'));
class Autoloader
{
protected static $classPaths = array();
protected static $classFileSuffix = '.php';
protected static $cacheFilePath = null;
protected static $cachedPaths = null;
protected static $excludeFolderNames = '/^CVS|\\..*$/';
// CVS directories and directories starting with a dot (.).
protected static $hasSaver = false;
/**
* Sets the paths to search in when looking for a class.
*
* @param array $paths
* @return void
示例4: session_start
<?php
session_start();
define('APP_ROOT', dirname(__FILE__) . '/protected');
// Get CoughPHP
require_once APP_ROOT . '/vendor/coughphp/load.inc.php';
require_once APP_ROOT . '/vendor/coughphp/as_database/load.inc.php';
require_once APP_ROOT . '/vendor/coughphp/extras/Autoloader.class.php';
Autoloader::addClassPath(APP_ROOT . '/models/');
Autoloader::setCacheFilePath(APP_ROOT . '/cache/cough_class_path_cache.txt');
spl_autoload_register(array('Autoloader', 'loadClass'));
// Get config stuff
require_once APP_ROOT . '/config/config.php';
require_once APP_ROOT . '/config/routes.php';
require_once APP_ROOT . '/config/database.php';
// Get system classes
require_once APP_ROOT . '/system/view.php';
require_once APP_ROOT . '/system/controller.php';
require_once APP_ROOT . '/system/uri.php';
// Parse URI
if (false === strpos($_SERVER['REQUEST_URI'], $config['uri_prefix'])) {
die('Configuration Error - Bad uri_prefix');
}
$path = substr($_SERVER['REQUEST_URI'], strlen($config['uri_prefix']));
$components = explode('/', $path);
for ($i = 0; $i < count($components); ++$i) {
if (empty($components[$i])) {
unset($components[$i]);
}
}
$controller_name = $config['default_controller'];