phpstorm报错:
代码:
$container = [];
function app($class_name) use ($container)
{
return $container -> get($class_name);
}
报错:
Parse error: syntax error, unexpected 'use' (T_USE), expecting '{' in C:\Users\shellus\www\php-redis-note\public\index.php on line 16
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
use得这样用:
只能用在闭包
建议看看这个帖子:
http://www.cnblogs.com/melonb...
匿名函数关键字
知道了,要这样才行:
use关键词只有闭包才能用 :)