1.设置插件类路径的缓存(将以下代码放入引导文件中)
$classFileIncCache = APPLICATION_PATH . '/../data/pluginLoaderCache.php';
if (file_exists($classFileIncCache)) {
include_once $classFileIncCache;
}
Zend_Loader_PluginLoader::setIncludeFileCache($classFileIncCache);
2.启用autoloader机制
然后注释require_once语句
% cd path/to/ZendFramework/library % find . -name '*.php' -print0 | xargs -0 \ sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'
3.缓存配置为数组
Zend_Application 加载配置文件的时候,其文件可以是一个返回数组的值,后缀名因为.inc或.php的文件。
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
'E:\Inetpub\ZendFramework-1.8.2\library',
get_include_path(),
)));
define('APPLICATION_INI',APPLICATION_PATH . '/configs/application.ini');
define('APPLICATION_INC',APPLICATION_PATH . '/../data/configCache.php');
//配置缓存处理函数返回路径
function loadConfigCache($ini, $inc, $environment){
// if ( 'development' === $environment) {
// return $ini;
// }
if (!file_exists($inc)) {
if ( !file_exists(dirname($inc)) || !is_writable(dirname($inc) )) {
throw new Exception('Specified file is not writeable (' . $inc . ')');
}
require_once 'Zend/Config/Ini.php';
$config = new Zend_Config_Ini($ini, $environment);
$configs = '<?php' . PHP_EOL . 'return ' . var_export($config->toArray(), true) . PHP_EOL . '?>';
file_put_contents($inc, $configs);
}
return $inc;
}
//loadConfigCache(APPLICATION_INI,APPLICATION_INC,APPLICATION_ENV);
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
loadConfigCache(APPLICATION_INI,APPLICATION_INC,APPLICATION_ENV)
);
$application->bootstrap()
->run();



