此代码抛出解析错误,我不明白为什么。
function t(){
return 'g';
}
function l(){
static $b = t();
return $b;
}
l();
问题是,为什么?
最佳答案
引用手册:
Note:
Trying to assign values to these [static] variables which are the result of expressions will cause a parse error.
(我的重点)
比较http://www.php.net/manual/en/language.variables.scope.php示例#7
关于php - php 中的 static 行为异常,无法接受函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8782094/