所以首先,我想要說我很新的編程所以請原諒我,如果我不盡快遵循前言。現在外部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