我使用Zend框架已经有一段时间了。我有一个问题,因为开始后,阅读了许多文件,我想知道为什么所有的例子都没有提到它。
我尝试用这种方式使用默认值(v 1.09)
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
以及默认index.php文件:
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
但到目前为止,我还不能使用单一的入口点,我不得不复制索引文件并给它相关控制器的名称。这样,我就可以正常加载页面,而不是出现500个服务器错误。
谢谢
我重新配置了服务器,以便通过虚拟主机而不是别名访问zend安装,这似乎是错误的。
我的化名是:
Alias /elul/ "c:\wamp\www\elul\trunk\elul\public/"
<Directory "c:\wamp\www\elul\trunk\elul\public/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:\wamp\www\examen_fle\trunk\examen_fle\public"
ServerName examen.elul.local
ErrorLog "logs/your_own-error.log"
CustomLog "logs/your_own-access.log" common
<directory "C:\wamp\www\examen_fle\trunk\examen_fle\public">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
因为它是本地运行的,所以我还必须在C:\ WINDOWS\system32\drivers\etc中编辑文件hosts以在文件中添加examan.elul.local
127.0.0.1 examen.elul.local