關於.inc檔案

來源:互聯網
上載者:User

在項目Web分頁檔中,發現這麼一句話:

    <!-- 頁面字元集設定 begin-->
    <!-- #INCLUDE FILE="http://www.cnblogs.com/Common/CommonHeader.inc" -->
    <!-- #INCLUDE FILE="http://www.cnblogs.com/Common/CommonInclude.inc" -->

 

一直以為是備註陳述式,沒留意。今天偶然發現這不是注釋。

.inc 檔案,顧名思義就是include file,實際上檔案的尾碼對於檔案包含是無所謂,你可以包含一個asp檔案,也可以包含txt文。一般我們使用inc作為尾碼,是因為這樣能體現該檔案的作用。
使用inc檔案可以使我們的程式,增加可讀性,更易於開發和維護。
.inc檔案的使用:

     使用SSI(Server Side Include)指令中的#Include,asp包含檔案的寫法是這樣的:在html中,寫:
  <!-- #include file = "FileName" -->
  <!-- #include Virtual = "FileName" -->
  file和Virtual的區別在於file使用相對路徑,而Virtual是你的web網站內虛擬目錄的完整虛擬路徑,比如:
  <!-- #include file = "inc/char.inc" -->
  就表示包含當前檔案所在的虛擬目錄路徑下面的inc目錄下的char.inc,寫成 virtual就可能就需要這麼寫了:
  <!-- #include virtual = "/myweb/inc/char.inc" -->

      .inc檔案可以包含一些字元集的設定,如:.inc

<base target="_self" />
<!-- 頁面字元集設定 begin-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 頁面字元集設定 begin-->
<!-- 頁面緩衝設定 begin-->
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<!-- 頁面緩衝設定 end -->

<!--++++++++++++++++++++++++++++++++++-->

<link href="http://www.cnblogs.com/../Style/aaa.css" type="text/css" rel="stylesheet" />
<link href="http://www.cnblogs.com/../Style/bbb.css" type="text/css" rel="stylesheet" />

<script type="text/javascript" src="http://www.cnblogs.com/../Script/bbb.js"></script>
<script type="text/javascript" src="http://www.cnblogs.com/../Script/aaa.js"></script>

 

參考:http://www.wangchao.net.cn/bbsdetail_542328.html

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.