應用程序,我需要羅Zend框架,並在PHP腳本其MVC應用,所以我可以做一些模型來查詢數據庫。該框架和一些庫被加載這種方式(腳本是由其他人創建):加載Zend框架及其在PHP腳本
/** Initialise Zend */
define('BRIDGE_BASE_DIR', dirname(__FILE__));
set_include_path(get_include_path().PATH_SEPARATOR.BRIDGE_BASE_DIR.'/../library');
require_once('Zend/Loader/Autoloader.php');
require_once 'Zend/Config/Ini.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('XYz');
$autoloader->registerNamespace('Yxz');
我想調用的模型是這樣的:Franchisee_Model_Franchisee::find($franchiseeId)
位於下:application/modules/franchisee/models/franchisee
我嘗試了很多方法,但無法加載完整的堆棧。有沒有簡單的方法來加載腳本中的ZF,包括應用程序和應用程序/模塊下的所有內容?
UPDATE
我想這太:
<?php
error_reporting(E_ALL & ~E_NOTICE);
/** Initialise Zend */
define('BRIDGE_BASE_DIR', dirname(__FILE__));
set_include_path(get_include_path().PATH_SEPARATOR.BRIDGE_BASE_DIR.'/../library');
require_once('Zend/Loader/Autoloader.php');
require_once 'Zend/Config/Ini.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('Xyz');
$autoloader->registerNamespace('Yzx');
/** Handle arguments */
if ($argc < 2) {
echo 'LOG: ' . Zend_Date::now()->toString('YYYY-MM-ddTHH:mm:ss') . ' Please set the environment.'.PHP_EOL;
exit(1);
}
define("APPLICATION_ENV", $argv[1]);
// echo 'LOG: ' . Zend_Date::now()->toString('YYYY-MM-ddTHH:mm:ss');
// echo " Current environment is: ".APPLICATION_ENV.PHP_EOL;
/** Zend_Application */
define(APPLICATION_PATH, dirname(__FILE__).'/../application');
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap();
echo "Running ZF version: " . Zend_Version::VERSION;
new Admin_Contract_Table();
,但我得到
Fatal error: Class 'Admin_Contract_Table' not found in /Users/myuser/dev/htdocs/Admin/current/vend_bridge/zend.php on line 42
我太累了,BYT當我使用新Admin_Contract_Table();我沒有找到類錯誤。我想知道爲什麼一切都必須如此困難與ZF – rtacconi 2012-07-12 12:12:31
管理合同表類定義在哪裏?你有'管理員'模塊嗎? – 2012-07-12 12:56:01
是應用程序/模塊/管理/模型/ Contacts.php – rtacconi 2012-07-12 14:05:23