位置: 编程技术 - 正文

PHP:class_uses()的用法_spl函数

编辑:rootadmin
class_uses

推荐整理分享PHP:class_uses()的用法_spl函数,希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 5 >= 5.4.0)

class_uses — Return the traits used by the given class

说明 array class_uses ( mixed $class [, bool $autoload = true ] )

This function returns an array with the names of the traits that the given class uses. This does however not include any traits used by a parent class.

参数

class

An object (class instance) or a string (class name).

autoload PHP:class_uses()的用法_spl函数

Whether to allow this function to load the class automatically through the __autoload() magic method.

返回值

An array on success, or FALSE on error.

范例

Example #1 class_uses() example

<?phptraitfoo{}classbar{usefoo;}print_r(class_uses(newbar));print_r(class_uses('bar'));function__autoload($class_name){require_once$class_name.'.php';}//use__autoloadtoloadthe'not_loaded'classprint_r(class_uses('not_loaded',true));?>

以上例程的输出类似于:

参见

class_parents() - 返回指定类的父类。 get_declared_traits() - 返回所有已定义的 traits 的数组

PHP:class_implements()的用法_spl函数 class_implements(PHP5=5.1.0)class_implements返回指定的类实现的所有接口。说明arrayclass_implements(mixed$class[,bool$autoload])本函数返回一个数组,该数组中包含了指定

PHP:uniqid()的用法_misc函数 uniqid(PHP4,PHP5)uniqid生成一个唯一ID说明stringuniqid([string$prefix=[,bool$more_entropy=false]])获取一个带前缀、基于当前时间微秒数的唯一ID。参数prefix有用的参数。

PHP:unpack()的用法_misc函数 unpack(PHP4,PHP5)unpackUnpackdatafrombinarystring说明arrayunpack(string$format,string$data)Unpacksfromabinarystringintoanarrayaccordingtothegivenformat.Theunpackeddataisstoredinanassociativearray.To

本文链接地址:https://www.jiuchutong.com/biancheng/280618.html 转载请保留说明!

上一篇:PHP:iterator_count()的用法_spl函数

下一篇:PHP:class_implements()的用法_spl函数

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络