ZF套用library規則

Naming Rule決定位置

class Zend_Db_Table_Abstract 置放於:library\Zend\Db\Table\Abstract.php

Application.ini要適當調整來自動載入library

[production]

phpSettings.display_startup_errors = 0

phpSettings.display_errors = 0

includePaths.library = APPLICATION_PATH "/../library"

bootstrap.path = APPLICATION_PATH "/Bootstrap.php"

bootstrap.class = "Bootstrap"

appnamespace = "Application"

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"

resources.frontController.params.displayExceptions = 0

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

autoloadernamespaces.util = "Util_" // 新增自動載入的Library Util

[staging : production]

自訂Class測試,置放於Library/Util/SessionHelper.php:

<?php

class Util_SessionHelper // 在Library的Util目錄下建立SessionHelper.php {

    public function getLongonId(){

        return "sheauren";

    }

}

?>

使用方式:

<?php

$SessionHelper=new Util_SessionHelper();

echo $SessionHelper->getLongonId();

?>

沒有留言:

橫式廣告