PHP中的::class
表示法是什么?
由于语法的性质,快速的Google搜索不会返回任何内容。
冒号冒号类
使用这种表示法的优点是什么?
protected $commands = [
\App\Console\Commands\Inspire::class,
];
发布于 2015-06-11 09:39:37
class
是特殊的,它是由php提供的,用于获取完全限定的类名。
参见http://php.net/manual/en/migration55.new-features.php#migration55.new-features.class-name。
<?php
class foo {
const test = 'foobar!';
}
echo foo::test; // print foobar!
https://stackoverflow.com/questions/30770148
复制相似问题