2020年4月10日
<?php$a = filetype('C:\phpstudy_pro\www');//dir$a = filetype('C:\phpstudy_pro\www\1.php');//filevar_dump($a);$path = 'C:\phpstudy_pro\www';var_dump(is_dir($path));var_dump(is_flie($path));var_dump(is_link($path));echo"<hr>";$path = 'C:\phpstudy_pro\www\1.php';var_dump(is_dir($path));var_dump(is_flie($path));var_dump(is_link($path));echo"<pre>";echo"file_exists() 函数:<br>";$path ="C:\phpstudy_pro\www";$path ="C:\phpstudy_pro\www\1.php";$path ="C:\phpstudy_pro\www\123";//false$path ="C:\phpstudy_pro\www\123.php";//false$res=flie_exisit($path);var_dump($res);echo"<hr>";echo"filesize() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=filesize($path);var_dump($res);ehco"<hr>";echo"filectime() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= date('Y-m-d H:i:s',filectime($path));var_dump($res);echo"<hr>";echo"fileatime() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= date('Y-m-d H:i:s',fileatime($path));var_dump($res);echo"<hr>";echo"stat() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= stat($path);var_dump($res);echo"<hr>"echo"is_readable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_readable($path);var_dump($res);echo"<hr>";echo"is_writable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_writable($path);var_dump($res);echo"<hr>";echo"is_executable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_executable($path);var_dump($res);echo"<hr>";echo"</pre>";php2<?php$a = filetype('C:\phpstudy_pro\www');//dir$a = filetype('C:\phpstudy_pro\www\1.php');//filevar_dump($a);$path = 'C:\phpstudy_pro\www';var_dump(is_dir($path));var_dump(is_flie($path));var_dump(is_link($path));echo"<hr>";$path = 'C:\phpstudy_pro\www\1.php';var_dump(is_dir($path));var_dump(is_flie($path));var_dump(is_link($path));echo"<pre>";echo"file_exists() 函数:<br>";$path ="C:\phpstudy_pro\www";$path ="C:\phpstudy_pro\www\1.php";$path ="C:\phpstudy_pro\www\123";//false$path ="C:\phpstudy_pro\www\123.php";//false$res=flie_exisit($path);var_dump($res);echo"<hr>";echo"filesize() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=filesize($path);var_dump($res);ehco"<hr>";echo"filectime() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= date('Y-m-d H:i:s',filectime($path));var_dump($res);echo"<hr>";echo"fileatime() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= date('Y-m-d H:i:s',fileatime($path));var_dump($res);echo"<hr>";echo"stat() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= stat($path);var_dump($res);echo"<hr>"echo"is_readable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_readable($path);var_dump($res);echo"<hr>";echo"is_writable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_writable($path);var_dump($res);echo"<hr>";echo"is_executable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_executable($path);var_dump($res);echo"<hr>";echo"</pre>";php3<?php$a = filetype('C:\phpstudy_pro\www');//dir$a = filetype('C:\phpstudy_pro\www\1.php');//filevar_dump($a);$path = 'C:\phpstudy_pro\www';var_dump(is_dir($path));var_dump(is_flie($path));var_dump(is_link($path));echo"<hr>";$path = 'C:\phpstudy_pro\www\1.php';var_dump(is_dir($path));var_dump(is_flie($path));var_dump(is_link($path));echo"<pre>";echo"file_exists() 函数:<br>";$path ="C:\phpstudy_pro\www";$path ="C:\phpstudy_pro\www\1.php";$path ="C:\phpstudy_pro\www\123";//false$path ="C:\phpstudy_pro\www\123.php";//false$res=flie_exisit($path);var_dump($res);echo"<hr>";echo"filesize() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=filesize($path);var_dump($res);ehco"<hr>";echo"filectime() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= date('Y-m-d H:i:s',filectime($path));var_dump($res);echo"<hr>";echo"fileatime() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= date('Y-m-d H:i:s',fileatime($path));var_dump($res);echo"<hr>";echo"stat() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res= stat($path);var_dump($res);echo"<hr>"echo"is_readable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_readable($path);var_dump($res);echo"<hr>";echo"is_writable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_writable($path);var_dump($res);echo"<hr>";echo"is_executable() 函数:<br>";$path="'C:\phpstudy_pro\www\1.php";$res=is_executable($path);var_dump($res);echo"<hr>";echo"</pre>";
笔记:
文件系统概述:
文件系统:数据在物理介质中的存放方式叫做文件系统
NTF 最大单个文件可以保存2T
FAT32 u盘
FAT16
EXT4
EXT3
文件类型:
在程序运行时,程序本身和数据一般都存在内存中,当程序结束运行后,存放在内容中的数据会释放;
如果需要长时间保存程序运行所需的原始数据,就必须以文件的形式存储在外部的储存介质上;
类型:window系统 exe txt ppt
php是以unix系统的文件系统为模型来开发的;
file 文件
dir 目录
char 字符设备 键盘 打印机
fifo 管道
link 快捷方式
block 块设备文件
unknown 未知
window系统中php只认为有file dir ppt这三种文件类型
文件相关的函数:
is_dir() 判断给定的路径是否是文件夹
is_flie() 判断给定的路径是否是文件
is_link() 判断给定的路径是否是符号连接(快捷方式)
文件属性:
file_exists() 检查文件或目录是否存在
filesize() 获取文件大小
filectime() 获取文件的创建时间
filemtime() 获取文件的修改时间
fileatime() 获取文件的访问时间
stat() 获取文件的属性信息;返回数组
is_readable() 判断文件是否可读;这个文件可以被php读取内容
is_exectutable() 判断文件是否可执行;这个文件可以被php去运行
is_writable() 判断文件是否写;这个文件可以被php去修改内容
