當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Application::getAutoloader方法代碼示例

本文整理匯總了PHP中Zend_Application::getAutoloader方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Application::getAutoloader方法的具體用法?PHP Zend_Application::getAutoloader怎麽用?PHP Zend_Application::getAutoloader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Application的用法示例。


在下文中一共展示了Zend_Application::getAutoloader方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: app

 /**
  * Setup application
  *
  * @param  mixed $appPath Path to application root
  * @param  array $options Options to setup application
  * @access public
  * @return Zend_Application Application
  */
 public static function app($appPath, array $options = array())
 {
     defined('GENE_APP_PATH') || define('GENE_APP_PATH', $appPath);
     defined('GENE_LIB_PATH') || define('GENE_LIB_PATH', dirname(__FILE__));
     self::$_appPath = GENE_APP_PATH;
     if (!isset($options['ini'])) {
         $options['ini'] = rtrim(GENE_APP_PATH, '\\/') . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'app.ini';
     }
     if (!isset($options['env'])) {
         $options['env'] = 'production';
     }
     self::$_env = $options['env'];
     require_once 'Zend/Application.php';
     $app = new Zend_Application($options['env'], $options['ini']);
     $autoloader = $app->getAutoloader();
     $autoloader->setFallbackAutoloader(true)->suppressNotFoundWarnings(false);
     $app->getBootstrap()->setAppPath($appPath);
     if (isset($options['config'])) {
         $app->setConfigPath($options['config']);
     }
     $resources = null;
     if (isset($options['resources'])) {
         $resources = $options['resources'];
     }
     $bootstrap = $app->getBootstrap()->bootstrap($resources);
     $params = $bootstrap->getParams();
     self::$_params = $params;
     return $app;
 }
開發者ID:heavenshell,項目名稱:gene,代碼行數:37,代碼來源:Base.php

示例2: testPassingZfVersionAutoloaderInformationConfiguresAutoloader

 public function testPassingZfVersionAutoloaderInformationConfiguresAutoloader()
 {
     if (!constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_ENABLED')) {
         $this->markTestSkipped();
     }
     if (!constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST')) {
         $this->markTestSkipped();
     }
     $path = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_PATH');
     $latest = constant('TESTS_ZEND_LOADER_AUTOLOADER_MULTIVERSION_LATEST');
     $application = new Zend_Application('production', array('autoloaderZfPath' => $path, 'autoloaderZfVersion' => 'latest'));
     $autoloader = $application->getAutoloader();
     $actual = $autoloader->getZfPath();
     $this->assertContains($latest, $actual);
 }
開發者ID:nbcutech,項目名稱:o3drupal,代碼行數:15,代碼來源:ApplicationTest.php

示例3: catch

// We load main application configuration file, all sections (null) and we allow to further modify configuration values (true)
try {
	$config = new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'application.ini', null, true);
	$config->merge(new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'routing.ini'));
	if (is_file(APPLICATION_PATH . DS . 'configs' . DS . 'custom.ini')) {
		$config->merge(new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'custom.ini'));
	}
} catch (Zend_Config_Exception $e) {
	if (PHP_SAPI !== 'cli') header('Content-Type: text/plain; charset=UTF-8');
	exit('The application was unable to read one of the main configuration file (application.ini or routing.ini). It makes me a sad panda as well.' . PHP_EOL);
}

try {
	// Instantiate the application, bootstrap, and run
	$application = new Zend_Application(APPLICATION_ENV, $config->{APPLICATION_ENV});

	$autoloader = $application->getAutoloader();

	// We want the autoloader to load any namespace
	$autoloader->setFallbackAutoloader(false);
	// We want to be informed about missing classes in a clear way
	// There's a conflict with Doctrine trying to load non-existing (created at run-time) classes
	$autoloader->suppressNotFoundWarnings(true);

// Catch any uncaught exceptions
} catch (Exception $e) {
	if (PHP_SAPI !== 'cli') header('Content-Type: text/plain; charset=UTF-8');
	exit('Application error: ' . $e->getMessage() . PHP_EOL . $e->getTraceAsString() . PHP_EOL);
}
開發者ID:niieani,項目名稱:nandu,代碼行數:29,代碼來源:initenv.php

示例4: realpath

<?php

require realpath('../application') . '/config.php';
/** Zend_Application */
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . 'configs/application.ini');
Zend_Session::start();
/**
 * Thiết lập không hiển thị lỗi nếu là phiên bản production
 *
 */
if ('production' !== APPLICATION_ENV) {
    $application->getAutoloader()->suppressNotFoundWarnings(false);
}
$application->bootstrap()->run();
開發者ID:hoaitn,項目名稱:bmw-site,代碼行數:15,代碼來源:index.php

示例5: define

 * with loading,  using,  modifying and/or developing or reproducing the
 * software by the user in light of its specific status of free software,
 * that may mean  that it is complicated to manipulate,  and  that  also
 * therefore means  that it is reserved for developers  and  experienced
 * professionals having in-depth computer knowledge. Users are therefore
 * encouraged to load and test the software's suitability as regards their
 * requirements in conditions enabling the security of their systems and/or
 * data to be ensured and,  more generally, to use and operate it in the
 * same conditions as regards security.
 *
 * The fact that you are presently reading this means that you have had
 * knowledge of the CeCILL-C license and that you accept its terms.
 *
 * @author Copyright (c) PadCMS (http://www.padcms.net)
 * @version $DOXY_VERSION
 */
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'application'));
//Define path to the public directory
define('SITE_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'front'));
// Define application environment
define('APPLICATION_ENV', 'test');
define('APPLICATION_PREFIX', 'cli');
// Ensure include/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'include'), get_include_path())));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$oApplication = new Zend_Application(APPLICATION_PREFIX . '_' . APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$oApplication->getAutoloader()->setFallbackAutoloader(true);
$oApplication->bootstrap();
開發者ID:pansot2,項目名稱:PadCMS-backend,代碼行數:31,代碼來源:bootstrap.php


注:本文中的Zend_Application::getAutoloader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。