Because the project needs to use the Zend Framework, I recently found some information on the Internet. Now I want to save it for backup. If you have any mistakes, please kindly advise.
1) directory structure:
| --Repos
| --Application
| -- Botnet. php -------------------------- global bootstrap File
| --Configs
| -- Application. ini ------------------------ global configuration file
| --Modules
| --Default
| -- Bootstrap. php ----------------- module bootstrap File
| --Configs
| -- Module. ini --------------------- module configuration file
| --Controllers
| -- ErrorController. php
| -- IndexController. php
| --Models
| -- Albums. php
| --Views
| --Layout
| -- Default. phtml
| --Scriptx
| --Error
| -- Error. phtml
| --Index
| -- Index. phtml
| --Data
| --Log
| -- Application. Log ----------------------- Error Log (the Directory should have the write permission)
| --Library
| --Personal
| --Plugin
| -- Loader. php ----------------------- controller plug-in
| -- Log. php -------------------------- log plug-in
| --Zend
| --Public
| -- Index. php ------------------------------ entry file
| --. Htaccess
2) configuration file
Application. ini
[production]phpSettings.display_startup_errors = 0phpSettings.display_errors = 0includePaths.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 = 1phpSettings.display_errors = 1[development : production]phpSettings.display_startup_errors = 1phpSettings.display_errors = 1database.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"
Module. ini
[Production] phpSettings. display_startup_errors = 0phpSettings. display_errors = 0default. resources. layout. layout = "default" // set the view name of the default module to default. phtml default. resources. layout. layoutPath = APPLICATION_PATH "/modules/default/views/layout" // set the default module View File path [staging: production] [testing: production] phpSettings. display_startup_errors = 1phpSettings. display_errors = 1 [development: production] phpSettings. display_startup_errors = 1phpSettings. display_errors = 1
3) Portal file:
Index. php
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)));// Define path to application directorydefined('APPLICATION_PATH') || define('APPLICATION_PATH', BASE_PATH . '/../application');// Define application environmentdefined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));// Ensure library/ is on include_pathset_include_path(implode(PATH_SEPARATOR, array( realpath(APPLICATION_PATH . '/../library'), get_include_path(),)));/** Zend_Application */require_once 'Zend/Application.php';// Create application, bootstrap, and run$application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');$application->bootstrap() ->run();
. Htaccess
SetEnv APPLICATION_ENV developmentRewriteEngine OnRewriteCond %{REQUEST_FILENAME} -s [OR]RewriteCond %{REQUEST_FILENAME} -l [OR]RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^.*$ - [NC,L]RewriteRule ^.*$ index.php [NC,L]