• 请不要在回答技术问题时复制粘贴 AI 生成的内容
xoxo419
V2EX  ›  程序员

PHP 中的$this->container['request'] instanceof Request 是什么意思?

  •  
  •   xoxo419 · Aug 9, 2018 · 2453 views
    This topic created in 3007 days ago, the information mentioned may be changed or developed.

    $this->container['request'] instanceof Request 这段代码是什么操作?

    6 replies  •  2018-08-10 08:47:47 +08:00
    airdge
    airdge
    Aug 9, 2018
    1
    判断$this->container['request']是不是属于 Request 类
    xoxo419
    xoxo419
    OP
    Aug 9, 2018
    3
    在群里收到的回复

    1. 判断 IOC 中的对象的 class 是不是 Request
    2. 应该是判断当前的 Request 实例,是不是 Dingo 的 Request。是就抛一个 Dingo 的验证异常,不是就抛 Laravel 的验证异常

    搜索关键字: "PHP instanceof"

    资料-详解 PHP 中 instanceof 关键字及 instanceof 关键字有什么作用: https://www.jb51.net/article/74409.htm
    swcat
    swcat
    Aug 9, 2018 via Android❤️1
    4
    很想抛出鸟哥语录
    NEETLEE
    NEETLEE
    Aug 10, 2018
    6
    instanceof 是一个判断变量类型的关键字啦,看懂了他,整句话的意思应该就很好理解了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5057 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 05:58 · PVG 13:58 · LAX 21:58 · JFK 00:58
    ♥ Do have faith in what you're doing.