参考文档:http://www.php.net/manual/zh/functions.anonymous.php
用 use 语言结构传递进去
<?php
// Closures can also accept regular arguments
$example = function ($arg) use ($message) {
var_dump($arg . ' ' . $message);
};
$example("hello");
?>
参考文档:http://www.php.net/manual/zh/functions.anonymous.php
用 use 语言结构传递进去
<?php
// Closures can also accept regular arguments
$example = function ($arg) use ($message) {
var_dump($arg . ' ' . $message);
};
$example("hello");
?>