dongyanzhui0524 2018-10-03 02:16
浏览 40
已采纳

Laravel 5.7 - 为什么以编程方式列出控制台命令返回0?

I'm currently trying to return the list of Artisan commands within my Laravel application. I tried running return var_dump(Artisan::('list')); with success, but my response was unexpected. It came back as int(0) or 0 when I took out the var_dump() function. When I run this same command in my console, it returns the list of artisan commands successfully.

Any thoughts on why this might be happening?

  • 写回答

1条回答 默认 最新

  • dongrong3171 2018-10-03 02:21
    关注

    Artisan::call() returns the exit code, just like the command would in the terminal. An exit code of 0 means the command executed successfully.

    Artisan::output() can be used to get the last command's output.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用