westdc-zf1/common.php

33 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2014-06-10 02:16:50 +00:00
<?php
//error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 1);
date_default_timezone_set('Asia/Shanghai');
$base_path = dirname(__FILE__);
// directory setup and class loading
set_include_path('.' . PATH_SEPARATOR . 'F:/library/zf1/library'
. PATH_SEPARATOR . $base_path . '/application/models'
. PATH_SEPARATOR . $base_path . '/application/module'
. PATH_SEPARATOR . $base_path . '/application/default/controllers'
. PATH_SEPARATOR . get_include_path());
//include "Zend/Loader.php";
//Zend_Loader::registerAutoload();
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
// load configuration
$config = new Zend_Config_Ini('../application/config.ini', 'general');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
// setup application authentication
$auth = Zend_Auth::getInstance();
$auth->setStorage(new Zend_Auth_Storage_Session('sanjiangyuan'));
// setup database
$db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
$registry->set('db',$db);