ZF框架学习笔记

1. 环境设置

define('APPLICATION_PATH','../application');
define('LANGUAGE_PATH','../language');
define('BASE_PATH',dirname(__FILE__));
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1);
date_default_timezone_set('Asia/Chongqing');
// 目录设置和类装载
set_include_path('.' . PATH_SEPARATOR . '../library/'
	. PATH_SEPARATOR . '../include/'
    . PATH_SEPARATOR . '../application/models/'
    . PATH_SEPARATOR . '../application/controllers/'
    . PATH_SEPARATOR . '../application/administrator/models/'
    . PATH_SEPARATOR . '../application/administrator/controllers/'
    . PATH_SEPARATOR . get_include_path());

require_once 'Zend/Loader/Autoloader.php';

2. Zend_Registry -- 全局对象注册表
	get / set / getInstance / setInstance / isRegistered
	
3. Zend_Loader -- 代码组织
	1. Zend_Loader_Autoloader --  it registers itself with spl_autoload
		原理: 通过 spl_autoload_register 进行注册
		code:
		$loader = Zend_Loader_Autoloader::getInstance();
		$loader->setFallbackAutoloader(true);
		$loader->suppressNotFoundWarnings(false);
		$loader->registerNamespace('App_');
		
		方法:
		registerNamespace(string $ns) :
			if your library code is prefixed with "App_", you could do so as follows: 
			$loader->registerNamespace('App_');
		suppressNotFoundWarnings(bool) 是否压制错误警告信息
		setFallbackAutoloader(bool)  
		
4. Zend_Config -- 简化访问和使用配置数据
	1. Zend_Config 向构造器中传入数组	
	2. Zend_Config_Ini 
	3. Zend_Config_Xml

5. Zend_Db

你可能感兴趣的:(sql,mvc,框架,PHP,Zend)