我是Zend Framework的新手.
我写了一个简单的Web服务,它使用Zend Framework返回模拟 XML 数据,模块结构如下:
AppName
application
configs
application.ini
modules
default
.....
api
controller
CatalogController.php
view
library
public
.htaccess
index.php
tests
在localhost(Windows 7)中,这些正在运行:
在我的生产服务器(linux)中,我从’找不到’404文件’:
但这很有效
我在Amazon Web Services中托管它.
这是我的.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]
这是我的application.ini
[production]
phpSettings.display_startup_errors = 0
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.params.displayExceptions = 0
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = "default"
resources.modules[] = "api"
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
resources.layout.layout = master
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
这是我的Bootstrap.php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initRoutes()
{
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$restRoute = new Zend_Rest_Route($front, array(), array('api'));
$router->addRoute('api', $restRoute);
}
}
?>
我已经没想完了.我怀疑这与bootstraper中的路由器有关,但找不到任何解决方案.