2013-04-18 33 views
0

我能夠成功地爲ZF2安裝zend骨架框架。但由於某些原因,我在eclipse中出現錯誤,而且應用程序也找不到zend庫類。ZF2:未找到Eclipse和zend庫中的錯誤

enter image description here

我有這個在我的init_autoloader.php

$zf2Path = false; 
if (is_dir('vendor/ZF2/library')) { 
    $zf2Path = 'vendor/ZF2/library'; 
} elseif (getenv('ZF2_PATH')) {  // Support for ZF2_PATH environment variable or git submodule 
    $zf2Path = getenv('ZF2_PATH'); 
} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value 
    $zf2Path = get_cfg_var('zf2_path'); 
} 

if ($zf2Path) { 
    if (isset($loader)) { 
     $loader->add('Zend', $zf2Path); 
    } else { 
     include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; 
     Zend\Loader\AutoloaderFactory::factory(array(
      'Zend\Loader\StandardAutoloader' => array(
       'autoregister_zf' => true 
      ) 
     )); 
    } 
} 

我看到供應商2個zendframework文件夾,ZF2是空的,zendframework文件夾包含斌,演示,圖書館,資源等文件夾。這是圖書館應該居住的地方嗎?如果是的,爲什麼我有ZF2空文件夾?

enter image description here

兩個問題:1。 如何應用找到庫類? 2.如果我想創建一個谷歌放置api類。我在哪裏放置它,以及如何使它可以從任何模塊訪問?

更新: 隨着山姆的評論,我做了一個小搜索,並得到這個post,解決了我的日食問題。

+0

這是一個純粹的IDE關注點,我會重複這一點。看來你的Eclipse甚至不支持命名空間... – Sam

+0

好的,謝謝@Sam我不知道 – VishwaKumar

回答

1

你可能得到Eclipse設置爲PHP 5.1/2

Window > Preferences > PHP > PHP Interpreter > PHP Version > 5.3 

現在會奇蹟般地認識的命名空間。

如果您願意,也可以按項目的基礎設置項目。

相關問題