所以首先,我想要说我很新的编程所以请原谅我,如果我不尽快遵循前言。现在外部CSS文件未在浏览器中加载
,我有说是真正困扰我的最后几天一个问题,我也到处去寻找一个解决方案。
我使用的是WAMP的服务器配置。在我开始使用CSS之前,一切工作都很好。我有一个外部CSS文件。
当我在Dreamweaver中查看我的HTML页面,我看到它是正确连接到CSS文件。我可以在设计视图中看到应用的样式。但是,当我在浏览器中查看页面时,Firefox说(在错误控制台中)无法加载.css文件,因为它的MIME类型是text/html而不是text/css。
所以我想这是一个服务器的配置问题。我做的是以下内容: 我进入.HTACCESS文件并添加了以下行: AddType文本/ css .css
重新启动我的服务器后,仍然没有解决问题。出于某种原因,浏览器不断阅读我的CSS文件作为html文件。任何想法可能在这里出错?
这里的文件我想在浏览器中加载(它实际上是一个Smarty的模板)的头:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../htdocs/css/styles.css" type="text/css" media="all" />
</head>
而且,请注意,我用的是Zend框架编码。 这里是我的.htaccess文件:
RewriteEngine叙述上
的RewriteCond%{} SCRIPT_FILENAME -f
的RewriteCond%{} SCRIPT_FILENAME -d
重写规则^ $指数!(*)。 .PHP/$ 1
将AddType文本/ CSS的CSS
所以我把DA的意见,并点击查看页面源代码视图时浏览器中的页面,并点击链接到我的CSS文件。这就是它显示我:
当我点击链接时,我看到:
<br />
<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>(!)</span> Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in C:\shaancode\www\phpweb20\htdocs\Zend\Controller\Dispatcher\Standard.php on line <i>248</i></th></tr>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>(!)</span> Zend_Controller_Dispatcher_Exception: Invalid controller specified (error) in C:\shaancode\www\phpweb20\htdocs\Zend\Controller\Dispatcher\Standard.php on line <i>248</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0006</td><td bgcolor='#eeeeec' align='right'>382488</td><td bgcolor='#eeeeec'>{main}()</td><td title='C:\shaancode\www\phpweb20\htdocs\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0892</td><td bgcolor='#eeeeec' align='right'>4748936</td><td bgcolor='#eeeeec'>Zend_Controller_Front->dispatch()</td><td title='C:\shaancode\www\phpweb20\htdocs\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>42</td></tr>
</table></font>
什么是你的CSS文件的文件名,当你查看浏览器是什么您链接样式标签说呢? – corroded 2011-03-15 04:17:52
你能显示代码吗? – sandeep 2011-03-15 04:18:15
嘿,Shaan,我们需要看到头部的HTML,找出发生了什么。一旦你发布了这些内容,我们就会对发生的事情有更多的了解。 – Dan 2011-03-15 04:18:44