public static function(){
}
或
static public function(){
}
这两种方法我都见过,而且似乎都有效。 有关系吗? 有区别吗?
最佳答案
PHP Manual> Language Reference> Classes and Objects> Static Keyword
Example #1 Static method example
<?php class Foo { public static function aStaticMethod() { // ... } }
PHP Manual> Language Reference> Classes and Objects> Visibility
The visibility of a property or method can be defined by prefixing the declaration with the keywords
public
,protected
orprivate
.
所以即使允许,经典的方式是public static
关于php - 创建 PHP 静态函数时,将静态放在第一位或第二位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40687662/