⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usefileclass.php

📁 PHP4_0入门与提高源程序代码
💻 PHP
字号:
<?php
include("class.File.php");	//把File类的定义包含进来
    $File = new File;		//声明一个新对象
    $fakeUid = getmyuid();	//使用PHP的函数得到UID
    $RealUid = $File->get_real_uid();		//使用这个类的方法得到UID
    $RealGid = $File->get_real_gid();		//使用这个类的方法得到GID
	//输出所得结果
    echo "Process claims to be UID [$fakeUid]<BR>\n";	
    echo "Process is -really- [$RealUid / $RealGid] <BR>\n";
	
    $oldFile = 'old.html';
    $newFile = 'new.html';
	//把$oldFile的内容复制到$newFile中
    if(!$File->copy_file($oldFile,$newFile))
    {
        echo "$File->ERROR <BR>\n";
        exit;
    }
    $contents = $File->read_file($newFile);		//读取$contents的内容
    echo "<PRE>$contents</PRE>\n";	//把内容输出
    unlink($newFile); 	//删除文件$newFile
	//向$newFile中写内容
    if(!$File->write_file($newFile,$contents))
    {
        echo "$File->ERROR <BR>\n";
        exit;
    }
    $plainText = $File->strip_read($newFile);	//以纯文本形式读取$newFile
    echo "<PRE>$plainText</PRE>\n";		//输出纯文本格式的$newFile
	//检查文件$newFile的所有者
    if($File->is_owner($newFile))
    {
        echo "File UID and process UID match<BR>\n";
    } else { echo "File UID and process UID mismatch<BR>\n"; }
	//检查所属用户所在的组
    if($File->is_inGroup($newFile))
    {
        echo "File GID and process GID match<BR>\n";
    } else { echo "File GID and process GID mismatch<BR>\n"; }
    exit;
	?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -