【问题标题】:Give line breaks while running seeder through artisan通过工匠运行播种机时换行
【发布时间】:2014-12-19 07:26:42
【问题描述】:

如何通过 php 的 echo 命令换行以在脚本运行期间提供有意义的状态消息。

我尝试过echo/n 但无济于事,我必须使用空格来补偿,这非常耗时。请帮忙。

【问题讨论】:

    标签: php laravel laravel-artisan


    【解决方案1】:

    您应该使用 Artisan 输出命令:

    $this->info('Display this on the screen');
    ...
    $this->error('Something went wrong!');
    

    您可以阅读更多关于它的信息here on the Laravel Docs

    【讨论】:

    • 我在 DatabaseSeeder 中使用的代码给出了未定义的方法错误,我该如何在这里使用它?
    • 我将代码移到了一个新命令中,显然必须从 Command 扩展类。
    猜你喜欢
    • 2020-01-21
    • 2014-05-04
    • 2016-07-03
    • 2017-03-20
    • 2015-04-06
    • 1970-01-01
    • 2018-11-30
    • 1970-01-01
    • 2018-08-08
    相关资源
    最近更新 更多