Laravel 的一个语法问题

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        //
        \App\Console\Commands\ESInit::class
    ];

    /**

如上所示 其中php \App\Console\Commands\ESInit::class的::调用的是静态方法,那么这里的class什么意思呢

《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
最佳答案
dd(
\App\Console\Commands\ESInit::class ==  'App\Console\Commands\ESInit'
);
//true

看爱好 喜欢'App\Console\Commands\ESInit'就用他

我比较喜欢 \App\Console\Commands\ESInit::class

3年前 评论
讨论数量: 4
dd(\App\Console\Commands\ESInit::class);
3年前 评论
dd(
\App\Console\Commands\ESInit::class ==  'App\Console\Commands\ESInit'
);
//true

看爱好 喜欢'App\Console\Commands\ESInit'就用他

我比较喜欢 \App\Console\Commands\ESInit::class

3年前 评论

所有类默认存在的一个成员,指向类所在的命名空间!

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!