php getrealpath,php模拟服务器实现autoindex效果的方法_php技巧

//文件浏览程序

error_reporting(0);

$pwd = empty($_GET['dir']) ? './' : $_GET['dir'];

$pwd = realpath($pwd);

if(is_file($pwd)) {

highlight_file ($pwd);

exit;

}else

$it = new FilesystemIterator($pwd);

?>

pwd of

pwd of

">../

foreach ($it as $file){

if($file->isDir()) {

$fileSize = '_';

$fileName = $file->getFilename() . '/';

} elseif($file->isFile()) {

$fileSize = $file->getSize();

$fileName = $file->getFilename();

}

$date = date('Y-m-d H:i',$file->getCTime());

?>getRealPath()?>">

2. 运行效果如下图所示:

希望本文所述对大家的php程序设计有所帮助。

...th){

if($this->getRealPath($url_path)){

if(is_readable($this->getRealPath($url_path))){

return

...

DOCUMENT_ROOT 与http://host/对应的路径。 getServletContext().getRealPath("/")

注意低版本Servlet规范中的等价表达方式是request.getRealPath("/")。

HTTP_XXX_YYY 访问任意HTT

...nds SplFileInfo{

public function __destruct(){

var_dump($this->getRealPath());

}

}

$file = new FileTest('index.php'); //boolean fa

...>

}

$date = date('Y-m-d H:i',$file->getCTime());

?>getRealPath()?>">

...

... {

@ rmdir( $file->getRealPath() );

}else{

@ unlink( $file->getRealPath() );

}

}

...hrows ServletException, IOException {

String path=this.getServletContext().getRealPath("/WEB-INF/classes/mess.properties");

//项目里src的文件都在

...().getParameter("imgname");String absPath = this.getServletContext().getRealPath("/images");//获取文件的保存路径System.out.println(absPath);Stri

...的上下文路径。

name = session.getServletContext().getRealPath("") + "\\" + realName + ".html";

...eName);template.setEncoding("UTF-8");File htmlFilel = new File(context.getRealPath("") +File.separator +"html"+File.separator+"channel");if(!

...rator($path); foreach ($files as $file) { $fileRealPath = $file->getRealPath(); //文件绝对路径 $compressCssFileRealPath = str_replace(".

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值