php【闭包语法】function() use ($arg) {}
时间:2016-12-16 14:22:05
收藏:0
阅读:236
$arg = ‘text‘; $test = function () use ($arg){ var_dump($arg); }; $test(); //输出text
$arg = ‘text‘; $test = function () use ($arg){ var_dump($arg); $arg = ‘text2‘; }; $test(); //输出text $arg = ‘text3‘; $test(); //输出text
原文:http://www.cnblogs.com/wy04313/p/6186465.html
评论(0)