ZendFramework 不重定向到操作 url => 控制器/操作



我在我的应用程序中创建了一个名为UserController的控制器,并在其中创建了一堆动作,这些动作目前是空的。我使用zf create controll userzf create action new user

我创建了一个虚拟主机'aman_proj'

当我输入url 'aman_proj/'时,它会显示/public中的index.php页面。

但是当我输入'aman_proj/user/new'时,它仍然显示/public中的index.php文件。

谁能告诉我为什么会这样?我粘贴我的index.php代码下面,让我知道,如果你需要看到更多的代码。我的控制器有动作,但它们都是空的。我在view/scripts/user/new. php 中有他们的视图
//public/index.php
<?php
echo "<b>This is Zend Home Page located in /public/index.php</b><br>";
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
echo "APPLICATION_PATH : ".APPLICATION_PATH."<br>";
// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
echo "APPLICATION_ENV : ".APPLICATION_ENV."<br>";
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));
echo "Paths : ".get_include_path()."<br>"; 
/** Zend_Application */
echo 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文件中有以下内容:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

我看不出你的index.php文件有什么问题,如果你没有得到错误页面,听起来就像请求没有被重写。

最新更新