首页 / PHP / php标准库(SPL)概述
php标准库(SPL)概述
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php标准库(SPL)概述,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2900字,纯文字阅读大概需要5分钟。
内容图文
![php标准库(SPL)概述](/upload/InfoBanner/zyjiaocheng/150/2e84a6f005594c13aa2ec859e032f868.jpg)
此扩展只能在php 5.0以后使用,并且从PHP 5.3.0 不再被关闭,会一直有效,成为php内核组件一部份。
数据结构
SPL提供了一组标准数据结构。
双向链表
双向链表 (DLL) is a list of nodes linked in both directions to each others. Iterator's operations, access to both ends, addition or removal of nodes have a cost of O(1) when the underlying structure is a DLL. It hence provides a decent implementation for stacks and queues.
SplDoublyLinkedList
SplStack
SplQueue
堆
Heaps are tree-like structures that follow the heap-property: each node is greater than or equal to its children, when compared using the implemented compare method which is global to the heap.
SplHeap
SplMaxHeap
SplMinHeap
SplPriorityQueue
阵列
Arrays are structures that store the data in a continuous way, accessible via indexes. Don't confuse them with PHP arrays: PHP arrays are in fact implemented as ordered hashtables.
SplFixedArray
映射
A map is a datastructure holding key-value pairs. PHP arrays can be seen as maps from integers/strings to values. SPL provides a map from objects to data. This map can also be used as an object set.
SplObjectStorage
迭代器
SPL 提供一系列迭代器以遍历不同的对象。
ArrayIterator
RecursiveArrayIterator
EmptyIterator
IteratorIterator
CallbackFilterIterator
RecursiveFilterIterator
RegexIterator
RecursiveCallbackFilterIterator
ParentIterator
RecursiveRegexIterator
RecursiveCachingIterator
AppendIterator
CachingIterator
FilterIterator
InfiniteIterator
LimitIterator
NoRewindIterator
MultipleIterator
RecursiveIteratorIterator
RecursiveTreeIterator
DirectoryIterator (extends SplFileInfo)
GlobIterator
RecursiveDirectoryIterator
FilesystemIterator
接口
SPL 提供一系列接口。
Countable
OuterIterator
RecursiveIterator
SeekableIterator
SplObserver
SplSubject
异常
SPL 提供一系列标准异常。
LogicException (extends Exception)
BadMethodCallException
BadFunctionCallException
DomainException
InvalidArgumentException
LengthException
OutOfRangeException
RuntimeException (extends Exception)
OutOfBoundsException
OverflowException
RangeException
UnderflowException
UnexpectedValueException
SPL函数
class_implements — 返回指定的类实现的所有接口。
class_parents — 返回指定类的父类。
class_uses — Return the traits used by the given class
iterator_apply — 为迭代器中每个元素调用一个用户自定义函数
iterator_count — 计算迭代器中元素的个数
iterator_to_array — 将迭代器中的元素拷贝到数组
spl_autoload_call — 尝试调用所有已注册的__autoload()函数来装载请求类
spl_autoload_extensions — 注册并返回spl_autoload函数使用的默认文件扩展名。
spl_autoload_functions — 返回所有已注册的__autoload()函数。
spl_autoload_register — 注册__autoload()函数
spl_autoload_unregister — 注销已注册的__autoload()函数
spl_autoload — __autoload()函数的默认实现
spl_classes — 返回所有可用的SPL类
spl_object_hash — 返回指定对象的hash id
文件处理
SPL 提供 一些与文件相关的类。
SplFileInfo
SplFileObject
SplTempFileObject
其他类及接口
ArrayObject
SplObserver
SplSubject
内容总结
以上是互联网集市为您收集整理的php标准库(SPL)概述全部内容,希望文章能够帮你解决php标准库(SPL)概述所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。