【发布时间】:2010-09-08 11:49:24
【问题描述】:
我有一个想要转换为 Zend 应用程序的应用程序。我必须继续在 zend 中执行下一个任务,但以前的页面应该可以正常工作。现有的 php 项目是一个简单的 php 项目,目录结构非常简单,所有文件都在一个文件夹中。
我单独创建了一个zend项目(测试)并将所有现有项目文件放在公共文件夹中。使用 test.dev 时,我设置为指向 test/public 文件夹的本地主机。当我在浏览器中使用 test.dev 时,将调用现有项目的 index.php 并显示现有项目的初始页面。现在我创建了一个控制器(人)和动作(索引)。现在,当我使用 test.dev/person/index 时,首先显示现有项目内容,然后在页面末尾显示 person/index(controller/action) 内容显示。
我想如果 url 中有控制器和操作,那么它应该只显示 zend 项目文件的内容,当 url 中有一个文件时,它应该简单地显示该文件。
我的test/public/index.php文件目前是这样的。
<html>
<head>
</head>
<body>
This is existing project's index content.
</body>
</html>
<?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') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
// Determine the protocol to use (http or https).
if (APPLICATION_ENV == 'production') {
define('HTTP_PROT', 'https://');
} else {
define('HTTP_PROT', 'http://');
}
/** 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();
?>
【问题讨论】:
标签: php zend-framework