당신이 위에서 언급 한 당신이 원하는 ZF 클래스를 포함한 관련이없는 것처럼 젠드 확장을 가능하게한다. 폴더에있는 ZF 파일을 다운로드하여 원하는 위치에 업로드하십시오. set_include_path()
을 사용해보세요! 아래의 샘플 코드 :
<?php
// Define relative path to ZendFramework in public_html
define('ZF_PATH', '/../../../lib/php/zendframework');
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define real path to ZendFramework if it's not yet included in include_path
if(!strpos(get_include_path(), 'zendframework'))
define('ZF_REAL_PATH', realpath(APPLICATION_PATH . ZF_PATH));
else define('ZF_REAL_PATH', '');
// Updating include_path
set_include_path(implode(PATH_SEPARATOR, array(ZF_REAL_PATH, get_include_path(),)));
// Done! the rest of the code might be unnecessary in your case.
require 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap()->run();
이 경로를 포함하는 디렉토리를 추가하는 경우에 대한 좀 복잡해 보일 수도 있지만 ZF 응용 프로그램이 사용하는 가장 일반적인 방법, 나는 생각한다. 지금
set_include_path(get_include_path().PATH_SEPARATOR.realpath('../path to folder containing zend classes'));
require_once('Zend/Loader.php');
require_once('Zend/Loader/Autoloader.php');
Zend_Loader::registerAutoload();
이 포함 수십 필요하지 않거나 젠드의로 코드 ... 를 어지럽히고 필요 :