/** * 自动载入函数 */ private function _setAutoload() { //自动载入函数 require_once dirname(__FILE__) . '/../LaneSmartFW/Autoload.php'; $autoload = new Autoload(); $autoload->register(); }
public function init() { require_once __DIR__ . '/class.autoload.php'; // 1. ИНИЦИАЛИЗАЦИЯ КЛАССА АВТОЗАГРУЗКИ $loaddata = array('prefix' => 'class.'); $autoload = new Autoload($loaddata); $autoload->add(FRAMEWORK_ROOT_FOLDER); $autoload->add(PROJECT_ROOT_DIRECTORY); $autoload->register(); // 2. ОСУЩЕСТВЛЕНИЕ ПОДКЛЮЧЕНИЯ К БАЗЕ ДАННЫХ self::$instance->connection = new \framework\database\mySqlConnect('localhost', 'root', '', 'craiglist'); // 3. ЗАГРУЗКА ШАБЛОНА ПРОЕКТИРОВАНИЯ MVC $controller = new \framework\mvc\FrontController(PROJECT_ROOT_DIRECTORY); $controller->run(); }
<?php /** * index file * * PHP Version 5.3.0 * * @category PHP * @package wsportfolio * @author Sergio Alejandro Valencia Lopez * @license http://www.opensource.org/licenses/bsd-license.php BSD License * @version SVN: $Id$ * */ require_once 'class/Conf/Autoload.php'; Autoload::register(array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Request', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Response', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Params', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Conf', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'Business')); if (isset($_GET['wsdl'])) { include_once 'Zend/Soap/AutoDiscover.php'; $autodiscover = new Zend_Soap_AutoDiscover(true); $autodiscover->setUri('http://127.0.0.1/webservice/index.php'); $autodiscover->setClass('WebService'); $autodiscover->handle(); } else { ini_set("soap.wsdl_cache_enabled", 0); $server = new SoapServer('wsdl/webservice.wsdl'); $server->setClass('WebService'); $server->setPersistence(SOAP_PERSISTENCE_SESSION); $server->handle(); }
<?php /** * Set up the Chamilo autoload stack. Can be called several time if needed also * better to avoid it. */ require_once dirname(__FILE__) . '/lib/autoload.class.php'; Autoload::register(); /** use Symfony\Component\ClassLoader\UniversalClassLoader; $loader = new UniversalClassLoader(); $loader->registerNamespaces(array( 'Symfony\\Component\\HttpFoundation', __DIR__.'/vendor/symfony/http-foundation', )); $loader->register(); */
private function _setAutoload() { require_once __DIR__ . '/Autoload.php'; $autoload = new Autoload(); $autoload->register(); }
<?php require_once 'config/AutoloadConfig.class.php'; require_once 'common/utils/Autoload.class.php'; // 注册需要自动加载的类 Autoload::register(AutoloadConfig::$DIR_LIST); // 注册异常处理 HandlerManager::register();
} protected function loadMappedFile($prefix, $relative_class) { if (isset($this->prefixes[$prefix]) === false) { return false; } foreach ($this->prefixes[$prefix] as $base_dir) { $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; if ($this->requireFile($file)) { return $file; } } return false; } protected function requireFile($file) { if (file_exists($file)) { require $file; return true; } return false; } } $loader = new Autoload(); $loader->register(); $loader->addPsr4('Bitphp', '../bitphp/src'); $loader->addPsr4('Models', '../app/models'); $loader->addPsr4('Views', '../app/views'); $loader->addPsr4('Controllers', '../app/controllers'); $loader->addPsr4('Components', '../app/components'); return $loader;
<?php /** * Created by PhpStorm. * User: vancleipicolli * Date: 15/01/2016 * Time: 13:22 */ require 'config.php'; require 'core/autoload/autoload.php'; $autoloader = new Autoload(); spl_autoload_register([$autoloader, 'load']); $autoloader->register('viewloader', function () { return require BASEPATH . '/core/view/viewLoader.php'; }); $view = new View(new ViewLoader(BASEPATH . '/views/')); $router = new Router();
// never found it return false; } /** * If a file exists, require it from the file system. * * @param string $file The file to require. * @return bool True if the file exists, false if not. */ protected function requireFile($file) { #echo $file; exit; if (file_exists($file)) { require $file; return true; } return false; } } $bitphp_loader = new Autoload(); $bitphp_loader->register(); $bitphp_loader->addPsr4('Bitphp\\Exceptions', 'bitphp/bitphp-exceptions/src'); $bitphp_loader->addPsr4('Bitphp\\Core', 'bitphp/bitphp-core/src'); $bitphp_loader->addPsr4('Bitphp\\Base', 'bitphp/bitphp-base/src'); $bitphp_loader->addPsr4('Bitphp\\Modules', 'bitphp/bitphp-modules/src'); $bitphp_loader->addPsr4('App\\Models', 'app/models'); $bitphp_loader->addPsr4('App\\Controllers', 'app/controllers'); $bitphp_loader->addPsr4('App\\Migrations', 'app/migrations'); $bitphp_loader->addPsr4('App\\Events', 'app/events'); $bitphp_loader->addPsr4('App\\Listeners', 'app/listeners'); return $bitphp_loader;
<?php namespace Mvc; header("Content-type: text/html; charset=utf-8"); header("Connection: Keep-Alive"); define('APP_PATH', dirname(__FILE__)); define('CTR_PATH', APP_PATH . '/applications/controllers/'); define('LIB_PATH', APP_PATH . '/applications/lib/'); $myLibLoader = new Autoload(); $myLibLoader->register($myLibLoader); $runtime = new \model_Runtime(); $runtime->start_microtime(); $controller = Applications::router(include APP_PATH . '/config/router.php'); $app = new $controller(); $app->run(); $runtime->end_microtime(); echo "<center>Spend {$runtime->spend_millisecond()} millisecond</center>";
private static function autoload() { require_once dirname(__FILE__) . '/./Autoload.class.php'; $obj = new Autoload(); $obj->register(); }