PHP取得当前文档所在的目录
2007-11-06 12:09
281 查看
<script type="text/javascript"><!--
google_ad_client = "pub-4490194096475053";
/* 内容页,300x250,第一屏 */
google_ad_slot = "3685991503";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<?
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function getcwdOL(){
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$total = $_SERVER[PHP_SELF];
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$file = explode("/", $total);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$file = $file[sizeof($file)-1];
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
return substr($total, 0, strlen($total)-strlen($file)-1);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$currenturl= getcwdOL()//取得当前目录
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
?>
例如文件所在的url为http://localhost/eng/ss/1.php
输出的值为eng/ss
ASP中一直想得到一个这样的函数,一直搞不定,搞得每次都要手改地址
如果哪位知道麻烦告诉我,谢谢。
google_ad_client = "pub-4490194096475053";
/* 内容页,300x250,第一屏 */
google_ad_slot = "3685991503";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<?
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function getcwdOL(){
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$total = $_SERVER[PHP_SELF];
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$file = explode("/", $total);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$file = $file[sizeof($file)-1];
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
return substr($total, 0, strlen($total)-strlen($file)-1);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
$currenturl= getcwdOL()//取得当前目录
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
?>
例如文件所在的url为http://localhost/eng/ss/1.php
输出的值为eng/ss
ASP中一直想得到一个这样的函数,一直搞不定,搞得每次都要手改地址
如果哪位知道麻烦告诉我,谢谢。
相关文章推荐
- PHP取得当前文档所在的目录
- PHP取得当前文档所在的目录
- PHP取得当前文档所在的目录
- DedeCMS获取文档当前栏目所在目录链接URL
- dedecms获取文档当前栏目所在目录链接URL
- PHP获取当前所在目录位置的方法
- 取IDE当前文档所在项目的目录[vs.net2008]
- DedeCMS获取文档当前栏目所在目录链接URL
- bat(传参情况下)取得当前bat所在的目录路径
- 取得当前模块所在目录名
- PHP获取当前文件所在目录 getcwd()函数
- PHP获取当前文件所在目录 getcwd()函数
- php --ini 可查看当前使用的php版本以及 php.ini所在的目录
- DedeCMS获取文档当前栏目所在目录链接URL
- PHP获取当前文件所在目录的父目录的路径(两种方法)
- PHP获取当前所在目录位置的方法
- casperjs 中取得当前脚本所在目录
- java中取得 当前程序运行所在的目录
- [SoapUI] 通过Groovy获取SoapUI当前Project所在的目录
- PHP 远程文件管理,可以给表格排序,遍历目录,时间排序 点击表格第一行,头部就可以排序了,这个列子是当前目录的