php文件路径的操作

$url = 'http://'.$_SERVER['HTTP_HOST'].substr($REQUEST_URI,0,strrpos($REQUEST_URI,'/'));
echo $url;
echo "<p>";
//echo strrpos($REQUEST_URI,'/');
//echo substr($REQUEST_URI,0,strrpos($REQUEST_URI,'/'));
echo dirname($_SERVER['SCRIPT_FILENAME']);
echo "<p>";
echo $_SERVER['PHP_SELF'];
echo "<p>";
echo $_SERVER['SCRIPT_NAME'];
echo "<p>";
echo $db=$_SERVER['DOCUMENT_ROOT'].'/access/db.mdb';
echo "<p>";
echo realpath("");
echo "<p>";
echo $_SERVER['DOCUMENT_ROOT'];
echo "<p>";
echo "<p>";
echo $_SERVER['DOCUMENT_ROOT']."<br>";   //获得服务器文档根
echo $_SERVER['PHP_SELF']."<br>"; //获得执行该代码的文件服务器绝对路径
echo __FILE__."<br>"; //获得文件的文件系统绝对路径
echo dirname(__FILE__); //获得文件所在的文件夹路径


结果
http://localhost/test

F:/kuikoo/test

/test/url.php

/test/url.php

F:/kuikoo/access/db.mdb

F:\kuikoo\test

F:/kuikoo

 

F:/kuikoo
/test/url.php
F:\kuikoo\test\url.php
F:\kuikoo\test

 

你可能感兴趣的:(PHP,F#,Access)