【问题标题】:Object of class Illuminate\Http\Response could not be converted to intIlluminate\Http\Response 类的对象无法转换为 int
【发布时间】:2021-08-15 20:51:34
【问题描述】:

我创建了一个 artisan 命令,它从已经构建的控制器(在句柄函数中)调用一个函数,并在通过 artisan 运行它时出现此错误:

 Object of class Illuminate\Http\Response could not be converted to int 

【问题讨论】:

  • return 有什么命令吗?
  • @shaedrich 是的,我做到了
  • 据我所知,您不应该这样做。
  • 能否请您添加导致此错误的代码。欢迎来到 SO :)

标签: php laravel laravel-artisan


【解决方案1】:

handle 函数不应返回值。 我的代码在从句柄函数中删除返回后工作。

注意:感谢@shaedrich

【讨论】:

    猜你喜欢
    • 2017-02-06
    • 2016-06-01
    • 2019-01-28
    • 1970-01-01
    • 1970-01-01
    • 2020-02-03
    • 2015-09-23
    • 1970-01-01
    • 2021-11-08
    相关资源
    最近更新 更多