zend项目以项目文件夹为控制器


Project folder is taken as controller in zend project

我正在windows服务器上设置一个演示Zend项目。这是基础url,比如http://example.com/JPZend/public/

但是在一些url上,比如http://example.com/JPZend/public/user/index?page=2它给出了以下页面没有发现错误,其中http://example.com/JPZend/public/user运行正常。

页面未找到
异常信息:
消息:Invalid controller specified (JPZend)
请求参数:

array (
  'controller' => 'JPZend',
  'action' => 'public',
  'user' => 'index',
  'module' => 'default',
  'page' => '2',
)

我错过了什么?好像是虚拟主机的问题?

通常,您使用公共文件夹作为web浏览器

所以你的URL应该是这样的:http://example.com/JPZend

ZF的默认路由是:

:controller/:action
Or with Modules enabled:
:module/:controller/:action

要告诉ZF您有另一个Base URL,您需要在application.ini:

中添加一行
resources.frontController.baseUrl = /JPZend/public

和你的或类似的在windows下:

RewriteEngine on
RewriteBase /JPZend/public

玩得开心!