我用这个撞墙了...
我需要在子目录中建立一个 zend 框架应用程序。
即域是 tricell.ss,我想使用 tricell.ss/tricell 作为应用程序主目录。
做了什么:
我在我的配置(application.ini)中设置了:
resources.frontController.baseUrl = "/tricell"
我在我的配置中创建了另一个 var
baseUrl = "/tricell"
在我的 Boostrap 中,我得到了这个:
$router = new Zend_Controller_Router_Rewrite(); $frontController->setRouter($router); $frontController->setBaseUrl($this->config->baseUrl); $frontController->dispatch();
在我的布局中,我尝试使用以下方式显示图像:
$this->baseUrl('/img/btn.png')
这是我的虚拟主机配置:
<VirtualHost *:80> DocumentRoot "/HTDOCS/tricell/tricell/public_html" ServerName tricell.ss RewriteRule ^$ [L] RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?tricell.ss$ RewriteRule ^(/)?$ tricell [L] </VirtualHost>
这是我的.htaccess:
SetEnv APPLICATION_ENV 开发
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
问题是当我尝试显示图像时没有任何反应。当我试图通过 URL 获取图像时:
http://tricell.ss//tricell/img/btn.png
我收到有关错误控制器的信息。我怎样才能做到这一点?我可以(没有任何问题)为 tricell.ss 之类的根域进行配置,然后获取图像,即 tricell/ss/img/btn.png,但我想在子目录上工作,而我不能用图像来做到这一点。我在这里做错了什么?