预览模式: 普通 | 列表

PHP得到根目录和删除文件及目录

<?php
$file = "test.txt";
if (!unlink($file))
  {
  echo ("Error deleting $file");
  }
else
  {
  echo ("Deleted $file");
  }
?>

  php可以获得站点的根目录

function GetRootPath()
{
        $sRealPath = realpath( './' ) ;

        $sSelfPath = $_SERVER['PHP_SELF'] ;
        $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ;

查看更多...

Tags: php

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 2116

 广告位

↑返回顶部↑