您的位置:首页 > 编程语言 > PHP开发

Zend Framework 多模块配置 (一)

2010-07-31 11:39 435 查看
因项目需要用到Zend Framework,所以最近在网上找了一些这方面的资料,现在整理一下留作备用,如有什么错误的地方欢迎指点。

1)目录结构:

|-- repos

|--|-- application

|--|--|-- Botstrap.php -------------------------- 全局bootstrap文件

|--|--|-- configs

|--|--|--|-- application.ini ---------------------- 全局配置文件

|--|--|-- modules

|--|--|--|-- default

|--|--|--|--|-- Bootstrap.php ------------------- 模块bootstrap文件

|--|--|--|--|-- configs

|--|--|--|--|--|-- module.ini --------------------- 模块配置文件

|--|--|--|--|-- controllers

|--|--|--|--|--|-- ErrorController.php

|--|--|--|--|--|-- IndexController.php

|--|--|--|--|-- models

|--|--|--|--|--|-- Albums.php

|--|--|--|--|-- views

|--|--|--|--|--|-- layout

|--|--|--|--|--|--|-- default.phtml

|--|--|--|--|--|-- scriptx

|--|--|--|--|--|--|-- error

|--|--|--|--|--|--|--|-- error.phtml

|--|--|--|--|--|--|-- index

|--|--|--|--|--|--|--|-- index.phtml

|--|-- data

|--|--|-- log

|--|--|--|-- application.log ----------------------- 错误日志(目录应有可写权限)

|--|-- library

|--|--|-- Personal

|--|--|--|-- Plugin

|--|--|--|--|-- Loader.php ----------------------- 控制器插件

|--|--|--|--|-- Log.php -------------------------- 日志插件

|--|--|-- Zend

|--|-- public

|--|--|-- index.php ------------------------------ 入口文件

|--|--|-- .htaccess

2)配置文件

application.ini

phpSettings.display_startup_errors             = 0
phpSettings.display_errors                         = 0
includePaths.library                                  = APPLICATION_PATH "/../library"
bootstrap.path                                           = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class                                          = "Bootstrap"
resources.frontController.moduleDirectory    = APPLICATION_PATH "/modules"
resources.modules[]                                   = "default"

[staging : production]

[testing : production]
phpSettings.display_startup_errors              = 1
phpSettings.display_errors                          = 1

[development : production]
phpSettings.display_startup_errors              = 1
phpSettings.display_errors                          = 1

database.adapter                                        = "Pdo_Mysql"
database.params.host                                 = "localhost"
database.params.username                          = "root"
database.params.password                          = "123456"
database.params.dbname                             = "test"
database.params.driver_options.1002           = "SET NAMES UTF8"

 ]
[production]
phpSettings.display_startup_errors               = 0
phpSettings.display_errors                           = 0

default.resources.layout.layout                      = "default"                       //设置default模块的视图名称为default.phtml
default.resources.layout.layoutPath                = APPLICATION_PATH "/modules/default/views/layout"          //设置default模块视图的文件path

[staging : production]

[testing : production]
phpSettings.display_startup_errors                = 1
phpSettings.display_errors                            = 1

[development : production]
phpSettings.display_startup_errors                = 1
phpSettings.display_errors                            = 1


3)入口文件:

index.php

SetEnv APPLICATION_ENV development

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: