spl是php标准库的缩写

spl文件处理类库: SplFileInfo  //是一个类用以获取文件的各种信息SplFileInfo的所有方法如下

方法名            - ---   说明
2. getATime( ) : --- Gets last access time of the file
3. getBasename( ) : --- Gets the base name of the file
4. getCTime( ) : --- 获取文件 inode 修改时间
5. getExtension( ) : --- Gets the file extension
6. getFileInfo( ) : --- Gets an SplFileInfo object for the file
7. getFilename( ) : --- Gets the filename
8. getGroup( ) : --- Gets the file group
9. getInode( ) : --- Gets the inode for the file
10. getLinkTarget( ) : --- Gets the target of a link
11. getMTime( ) : --- Gets the last modified time
12. getOwner( ) : --- Gets the owner of the file
13. getPath( ) : --- Gets the path without filename
14. getPathInfo( ) : --- Gets an SplFileInfo object for the path
15. getPathname( ) : --- Gets the path to the file
16. getPerms( ) : --- Gets file permissions
17. getRealPath( ) : --- Gets absolute path to file
18. getSize( ) : --- Gets file size
19. getType( ) : --- Gets file type
20. isDir( ) : --- Tells if the file is a directory
21. isExecutable( ) : --- Tells if the file is executable
22. isFile( ) : --- Tells if the object references a regular file
23. isLink( ) : --- Tells if the file is a link
24. isReadable( ) : --- Tells if file is readable
25. isWritable( ) : --- Tells if the entry is writable
26. openFile( ) : --- Gets an SplFileObject object for the file
27. setFileClass( ) : --- Sets the class used with openFile
28. setInfoClass( ) : --- Sets the class used with getFileInfo and getPathInfo
29. __toString( ) : --- Returns the path to the file as a string

如获取index.php的相关信息 的代码:

<?php
/*
*author:稻草人
*email:2282152858@qq.com
*cnblogs: http://cnblogs.com/scarecrowlxb
*create time :2017/3/11 23:14
*/
//获取文件信息
$file = new SplFileInfo("./index.php");
echo '创建时间:'.$file->getCTime().PHP_EOL;
echo '修改时间:'.$file->getMTime().PHP_EOL;
echo '文件大小:'.$file->getSize().PHP_EOL;
echo '文件名:'.$file->getFileName().PHP_EOL; //读取文件内容
$fileobj = $file->openFile("r");
while($fileobj->valid()){
//valid 是当读取到的内容无效时返回false
echo $fileobj->fgets();
}

  

具体见php参考手册中  函数参考->其他基本扩展->spl->文件处理

还有两个类:SplFileObject 和SplTempFileObject

SplFileObject 类继承了SplFileInfo 并实现文件的遍历查找操作

SplTempFileObject类继承了SplFileObject用于对临时文件操作

spl之文件处理的更多相关文章

  1. spl处理文件(文件详细信息、文件遍历、查询指定行、写入CSV文件)

    <?php /** * 文件操作 */ //常用操作 $file = new SplFileInfo('D:/workspace/xlyy/spl/test.txt'); $file_info ...

  2. PHP高级编程SPL

    这几天,我在学习PHP语言中的SPL. 这个东西应该属于PHP中的高级内容,看上去非常复杂,可是非常实用,所以我做了长篇笔记.不然记不住,以后要用的时候,还是要从头学起. 因为这是供自己參考的笔记,不 ...

  3. u-boot的SPL源码流程分析

    上次梳理了一下SPL的基本概念和代码总体思路,这次就针对代码跑的流程做个梳理.SPL中,入口在u-boot-spl.lds中 ENTRY(_start) SECTIONS { .text : { __ ...

  4. U-boot中SPL功能和源码流程分析

    在U-boot目录下,有个比较重要的目录就是SPL的,SPL到底是什么呢?为什么要用它呢? SPL(Secondary programloader)是uboot第一阶段执行的代码.主要负责搬移uboo ...

  5. php spl标准库简介(SPL是Standard PHP Library(PHP标准库)(直接看代码实例,特别方便)

    php spl标准库简介(SPL是Standard PHP Library(PHP标准库)(直接看代码实例,特别方便) 一.总结 直接看代码实例,特别方便易懂 thinkphp控制器利眠宁不支持(说明 ...

  6. PHP 文件操作的各种姿势

    使用 SPL 库 SPL 是 PHP 标准库,用于解决典型问题的一组接口与类的集合. 迭代器 FilesystemIterator 官方文档:http://php.net/manual/zh/clas ...

  7. SPL常用函数

    使用SPL_AUTOLOAD_REGISTER装载类 <?php /** * libs/Test.class.php */ class Test { function __construct() ...

  8. VIM7.3中文手册

    INDEX *index.txt*     For Vim version 7.3.  最近更新: 2010年7月 VIM 参考手册    by Bram Moolenaar 译者: Willis h ...

  9. sphinx ---rotate 运行机制

    如果sphinx在运行中,要indexer时,需要加上--rotate参数,这样索引完就直接生效了. 原因是sphinx的searchd在启动时会创建一个 .spl 锁文件,并在关闭时会删除它.在in ...

随机推荐

  1. .NET DLL 保护措施详解(非混淆加密加壳)核心思路的实现

    最近有很多朋友通过BLOG找到我询问我的相关细节,其实相关的实现细节我早已把源码上传到51aspx上面了,地址是http://www.51aspx.com/code/codename/56949 也有 ...

  2. 如何在Visio 2007中画接口和实现类的关系图

    http://blog.sina.com.cn/s/blog_53fc9db50100as5o.html 在Visio图形元素上,点击右键,选择“形状显示选项”,将“实现链接”选中,这个时候,类图形元 ...

  3. Excel里函数中的万金油,你确定不要点进来看看?

    Excel里函数中的万金油,你确定不要点进来看看? 来源:EXCELHome Excel里有个号称"万能"的函数组合,这个函数组合就是INDEX+SMALL+IF,很多应用场合都能 ...

  4. 6.00.1x Introduction to computation

    6.00 Introduction to Computer Science                  and  Programming • Goal: –Become skillful at ...

  5. Backdoor CTF 2013: 电子取证 250

    0x00 题目 h4x0r厌烦了你对他的城堡的所有攻击,所以他决定报复攻击你,他给你发来一封带有图片的邮件作为警告,希望你能找出他的警告消息:-) 消息的MD5值就是flag. 0x01 解题法1 给 ...

  6. Introduce: IEPI.BIATranscribe 图像表格拓写工具

    应用场合 数据表格是学术.文案工作中常用的表述形式.我们经常需要从第三方获取所需的数据.有些时候这些数据并非以可直接编辑的形式(如电子表格文档),而是以打印件或者扫描件的形式提供.假如需要对数据进行进 ...

  7. Python实现多线程HTTP下载器

    本文将介绍使用Python编写多线程HTTP下载器,并生成.exe可执行文件. 环境:windows/Linux + Python2.7.x 单线程 在介绍多线程之前首先介绍单线程.编写单线程的思路为 ...

  8. 融云发送手机短信验证短信(.net版本)

    首先本次需求是在MVC5中进行的,通过收费的融云服务来验证手机号码,而且本次的项目也是前后台分离,所以添加了WEBAPI2,那么先添加WEBAPI的接口 using System; using Sys ...

  9. Spring Boot 基础教程系列学习文档

    Spring Boot基础教程1-Spring Tool Suite工具的安装 Spring Boot基础教程2-RESTfull API简单项目的快速搭建 Spring Boot基础教程3-配置文件 ...

  10. JavaSE学习笔记

    1.数据类型 boolean char byte short int long double float double array class interface 总结: 前9种基本类型,后3中引用类 ...