我正在开发一个使用 Zend_Hostname_Router_Route 的项目。
我的应用程序相当简单。我有一个名为 dev 的模块,我想将其路由到 dev 子域。我在这里和其他网站上阅读了几篇文章,试图了解问题所在。
我正在为我的应用程序使用 ZF 1.12。我在 appllication.ini 文件中使用 Zend_Hostname_Router_Route,如下所示:
[production]
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.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
resources.view.encoding = "UTF-8"
resources.view.doctype = "HTML5"
resources.view.contentType = "text/html; charset=UTF-8"
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.db.adapter = "PDO_SQLITE"
resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook.db"
[development:production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.adapter = "PDO_SQLITE"
resources.db.params.dbname = APPLICATION_PATH "/..application/db/guestbook-dev.db"
resources.router.routes.type = "Zend_Controller_Router_Route_Hostname"
resources.router.routes.route = "dev.michaeldrowan.com"
resources.router.routes.chains.dev.type = "Zend_Controller_Router_Route"
resources.router.routes.chains.dev.route = ":controller/:action/"
resources.router.routes.chains.dev.defaults.module = "dev"
resources.router.routes.chains.dev.defaults.controller = "index"
resources.router.routes.chains.dev.defaults.action = "index"
ZF 快速入门教程中的应用程序。所以我不应该在设置它时遇到问题。我试过两个index.php。在 public_html 中打开,在下面文件夹的子域中打开(这是我的主机放入的位置)。子域中的索引指向开发模块..我也尝试了这样做的方式,这就是 zf 快速入门教程的方式
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../michaeldrowan /application/'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_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'
);
?>
dev 中的索引是:
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));
// Ensure library/ is on include_path
set_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();
?>
我试图通过将“生产”更改为“开发”来指向两者中的模块。我什至尝试过“开发:生产”
我还尝试将应用程序指向模块配置,并尝试将应用程序设置为模块。
我已经没有东西可以尝试了。我希望有一个人可以帮助我。