Atitit.擷取approot api 應用根路徑 java c#.net php asp

來源:互聯網
上載者:User

標籤:

Atitit.擷取approot api 應用根路徑 java c#.net php asp 

 

 

1. 如果根路徑返回empty,否則返回/app,相容getContextPath()

 

<script type="text/javascript" src="../com.attilax/core/approot_js.jsp"></script>

 

<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" %>

 

<%

String path = request.getContextPath();

 

%>

$app_path="<%=path%>";   

app_path="<%=path%>";

$envi="java";

apiurl="<%=aaaCfg.IocX4jobui.getCfgVal("hre_web_url")%>";

$iocx_iner="nonex";

$iocx="nonex";

 

作者:: 綽號:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿爾 拉帕努伊 ) 漢字名:艾龍,  EMAIL:[email protected]

轉載請註明來源: http://www.cnblogs.com/attilax/

 

2. 但是對於php 是指令碼語言,沒有approot的概念,

 

php中一般需要定義網站的根目錄,下面是常用的代碼,需要朋友可以參考下。

複製代碼代碼如下:


define(‘BASE_PATH‘,str_replace(‘\\‘,‘/‘,realpath(dirname(__FILE__).‘/../‘)));

 

這個是要人工指定的方式不好。。

最好的實踐是放個__approot檔案即可,指明了跟應用的路徑。。比較動態化。。

 

3. Asp.net

Request.ApplicationPath;// /aspnet

方法3、Request.ApplicationPath;//擷取伺服器上ASP.NET應用程式的虛擬應用程式根目錄

 

4. 參考

 

ASP.NET擷取根目錄的方法集合_我愛學習網.htm

痕網,痕網部落格,痕網工作室 - henw.htm

asp.net 擷取網站根目錄總結 詳細介紹--源碼之家(mycodes.net).htm

Atitit.擷取approot api 應用根路徑 java c#.net php asp

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.