本文整理汇总了PHP中spl_autoload_extensions函数的典型用法代码示例。如果您正苦于以下问题:PHP spl_autoload_extensions函数的具体用法?PHP spl_autoload_extensions怎么用?PHP spl_autoload_extensions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spl_autoload_extensions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init_autoload
/**
* 自动加载,只支持命名空间方式
* @param array $config
* @return \Core\Application
*/
public static function init_autoload()
{
spl_autoload_extensions('.php');
spl_autoload_register();
//spl_autoload_extensions ( '.php' );
//spl_autoload_register ('autoloader');
}
示例2: register
public static function register($prepend = false)
{
$error = false;
if (self::$autoloader_set) {
trigger_error("Auto loader already set", E_USER_NOTICE);
} else {
self::add_path(__DIR__ . DIRECTORY_SEPARATOR . "..");
$class_extensions = spl_autoload_extensions();
if (strpos($class_extensions, ".php") === false) {
spl_autoload_extensions($class_extensions . ",.php");
}
if (is_array(spl_autoload_functions()) && in_array("spl_autoload", spl_autoload_functions())) {
trigger_error("Auto loader already set", E_USER_NOTICE);
} else {
if (PHP_VERSION_ID < 50300) {
if (!spl_autoload_register("spl_autoload")) {
$error = true;
}
} else {
if (!spl_autoload_register("spl_autoload", true, $prepend)) {
$error = true;
}
}
}
if ($error) {
trigger_error("Could not add autoloader to the queue", E_USER_NOTICE);
} else {
self::$autoloader_set = true;
}
}
}
示例3: helper
public function helper($class)
{
$class = preg_replace('/_helper$/ui', '', $class);
set_include_path(get_include_path() . PATH_SEPARATOR . '/helper/');
spl_autoload_extensions('.helper.php');
spl_autoload($class);
}
示例4: helper
public function helper($class)
{
$class = $this->trim_namespace($class);
set_include_path($this->registry->appDir . '/helpers/');
spl_autoload_extensions('.help.php');
spl_autoload($class);
}
示例5: createSPLAutoloaders
private function createSPLAutoloaders()
{
spl_autoload_register(null, false);
spl_autoload_extensions('.php');
spl_autoload_register(array('Loader', 'loadGeneric'));
spl_autoload_register(array('Loader', 'loadModule'));
}
示例6: zroneClassLoader
/**
* è‡ªåŠ¨åŠ è½½
*
* @param $className
*/
function zroneClassLoader($className)
{
$path = array(str_replace("\\", "/", dirname(__FILE__) . DIRECTORY_SEPARATOR . "Vendor/"), str_replace("\\", "/", dirname(__FILE__) . DIRECTORY_SEPARATOR . "FrameWork/"), str_replace("\\", "/", dirname(__FILE__) . DIRECTORY_SEPARATOR . "Application/"));
if (isset($path) && is_array($path)) {
$Iterator = new ArrayIterator($path);
$Iterator->rewind();
$pathString = "";
while ($Iterator->valid()) {
$pathString .= $Iterator->current() . ";";
if ($Iterator->key() == count($path) - 1) {
$pathString = rtrim($pathString, ";");
}
$Iterator->next();
}
set_include_path($pathString);
spl_autoload_extensions(".php, .class.php");
spl_autoload($className);
} else {
try {
throw new Exception("<code style='color: red; font-size: 22px; display: block; text-align: center; height: 40px; line-height: 40px;'>I'm sorry, my dear! The FrameWork is Wrong……😫</code>");
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
示例7: setPath
public static function setPath()
{
$path = array(get_include_path(), ROOT_PATH . 'class');
set_include_path(implode(PATH_SEPARATOR, $path));
spl_autoload_extensions('.php');
spl_autoload_register();
}
示例8: init
/**
* Autoloader Class.
*
* @return void
*/
public function init()
{
// Specify the extensions that may be loaded
spl_autoload_extensions('.class.php, .interface.php, .trait.php');
// Register the loader methods
spl_autoload_register(array(__CLASS__, '_loadClass'));
$this->_loadFile();
}
示例9: initLoader
protected function initLoader()
{
$previousExtensions = explode(',', spl_autoload_extensions());
if (!in_array('.php', $previousExtensions)) {
spl_autoload_extensions(spl_autoload_extensions() . ',.php');
}
spl_autoload_register('spl_autoload', true, true);
}
示例10: run
/**
* Run the application
*/
public function run()
{
spl_autoload_extensions('.php, .class.php, .lib.php');
spl_autoload_register(array(self::instance(), '_autoload'));
$this->_loadDir();
$con = Config_Framework_Database::getDbConn();
new Config_Framework_Route();
}
示例11: init
public function init()
{
define('CLASS_DIR', 'core/');
set_include_path(get_include_path() . PATH_SEPARATOR . CLASS_DIR);
spl_autoload_extensions('.class.php');
spl_autoload_register();
$this->registry = Registry::getInstance();
}
示例12: load
/**
* Register method to autoload php classes files
*
* @static
* @access public
*/
public static function load()
{
if (!extension_loaded('spl')) {
die('SPL extension not loaded!');
}
spl_autoload_register(null, false);
spl_autoload_extensions('.inc.php, .view.php, .library.php');
spl_autoload_register('self::autoloader', true);
}
示例13: __construct
/**
*
*/
protected function __construct()
{
/*** specify extensions that may be loaded ***/
spl_autoload_extensions('.php, .class.php, .inc.php');
/*** nullify any existing autoloads ***/
// spl_autoload_register(null, false);
spl_autoload_register(__NAMESPACE__ . '\\ClassesLoader::registerClass');
// constants
$this->constants = new Constants();
}
示例14: init
/**
* Init Autoload Class.
*
* @return void
*/
public function init()
{
// Specify the extensions that may be loaded
spl_autoload_extensions('.php');
/** Register the loader methods **/
spl_autoload_register(array(__CLASS__, '_loadController'));
spl_autoload_register(array(__CLASS__, '_loadClass'));
spl_autoload_register(array(__CLASS__, '_loadModel'));
spl_autoload_register(array(__CLASS__, '_loadForm'));
}
示例15: init
/**
* Autoloader Class.
*
* @return void
*/
public function init()
{
// Specify the extensions that may be loaded
spl_autoload_extensions('.class.php, .interface.php, .trait.php');
// Register the loader methods
spl_autoload_register(array(__CLASS__, '_loadClass'));
$this->_loadFile('Core/License.class.php');
$this->_loadFile('Core/Kernel.class.php');
// Include Composer libraries (GeoIp2, Swift, ...)
require_once PH7_PATH_PROTECTED . 'vendor/autoload.php';
}