zend framework 圖片以及css路徑問題

來源:互聯網
上載者:User

剛開始學習zend framework ,對於路徑問題還是沒弄明白,以至於圖片不能正常顯示,搜遍了Google終於找到一個解決辦法。具體解決辦法如下:

 

在.htaccess中用下面這段代碼代替原有代碼

# Zend Framework rewrite規則
RewriteEngine on
RewriteCond
%{REQUEST_FILENAME} !-f
RewriteRule .* index.php
#
安全性考慮:不允許清單目錄內容
Options -Indexes
# PHP設定
php_flag magic_quotes_gpc
off
php_flag register_globals    off
php_flag short_open_tag     on

訪問的時候:

例如:我的css.css檔案在public/css下面,網站目錄是網站根目錄下面的webapp

則在模板檔案中的css引用為:

                                        絕對引用地址:/webapp/public/css/css.css

                                      相對參照地址:當前瀏覽器顯示的地址為基準目錄

                                                             如:我們現在訪問地址為http://localhost/webapp/

                                                              
則我們的相對參照地址為:。/public/css/css.css

                                                               如我們現在的訪問地址改為http://localhost/webapp/index/index

                                                             
則引用地址為:。。/public/css/css.css

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.