Zend_Controller尝试将样式表作为控制器执行
|
我在Bootstrap.php中为全局布局初始化占位符,如此处所述。
public function _initPlaceholders()
{
$this->bootstrap(\'View\');
$view = $this->getResource(\'View\');
$view->doctype(\'XHTML11\');
$view->headTitle(\'Foo Bar Title\')
->setSeparator(\' :: \');
$view->headMeta()->appendHttpEquiv(
\'content-type\',
\'application/xhtml+xml; charset=UTF-8\'
);
$view->headMeta()->appendName(\'robots\', \'index,follow\');
$view->headLink()->appendStylesheet(\'/styles/styles.css\', \'screen\')
->appendStylesheet(\'/styles/print.css\', \'print\');
}
呈现的HTML看起来正确。
<title>Foo Bar Title</title>
<link href=\"/styles/styles.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\" />
<link href=\"/styles/print.css\" media=\"print\" rel=\"stylesheet\" type=\"text/css\" />
<meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=UTF-8\" />
<meta name=\"robots\" content=\"index,follow\" />
但是CSS无法正确加载,因为Zend_Controller认为它是控制器之类的东西。当我尝试打开CSS文件时,发生以下错误:
致命错误:未捕获的异常
\'Zend_Controller_Dispatcher_Exception \'
带有消息“无效的控制器”
指定(错误)\'
有什么提示吗?
[更新]
好的,只需将以下行添加到我的.htaccess文件中即可,一切现在都可以按预期进行了...
重写规则
!。((js | ico | txt | gif | jpg | png | css | htc | swf | htm)$
index.php
没有找到相关结果
已邀请:
1 个回复
糖固傻染
你看起来相似吗?具体来说,您是否在公用文件夹(而不是应用程序文件夹)下的某个位置有CSS和JavaScript文件?如果是这样,您可以查看文件权限吗? 另外,我建议检查文件权限。如果Apache进程无法读取CSS文件,则Apache将无法为其提供服务。