当前位置:Gxlcms > PHP教程 > 为什么函数使用use会报错?

为什么函数使用use会报错?

时间:2021-07-01 10:21:17 帮助过:26人阅读

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

人气教程排行