我正在使用 PHP 5.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();