我使用的是PHP5.4、Zend Studio和Zend-Server。
当我使用这个uri时,我得到了一个404错误:
http://localhost/MyExample/public/index.php但是当我使用这个uri时,我得到了要显示的正确页面:
http://localhost/MyExample/public/index.php/我认为这两个uri应该是相同的。
下面是.htaccess文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]下面是index.php代码:
<?php
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// Setup autoloading
require 'init_autoloader.php';
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();发布于 2013-02-25 22:47:38
备注:将之前的评论添加为答案
这是正确的行为。键入http://localhost/index.php时传递给路由器的URI包含"index.php"。
由于没有匹配"index.php"的路由,Zend Framework2显示了404错误。
当使用"/"或"/index.php/"、the path matched by the router is empty时,您将获得匹配的默认"home"路由的ZendSkeletonApplication。
https://stackoverflow.com/questions/15048724
复制相似问题