Welcome to Qi-U Community for programmer and developer-Open, Learning and Share

Categories

0 votes
82 views
in Technique[技术] by (31.9m points)

php 中的闭包函数

比如说定义一个闭包函数$fn
$fn->call()
$fn instanceof Closure

这是对象的用法,难道说闭包函数即是函数也是对象?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (31.9m points)

Closure 类 是代表匿名函数的类
闭包函数作为变量的值来使用。PHP 会自动把此种表达式转换成内置类 Closure 的对象实例


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Qi-U Community for programmer and developer-Open, Learning and Share
...