为什么php ==没有在工匠修补工作上工作

问题描述 投票:0回答:2

正如我的标题,我试图用equal id获取数据==,但结果为空数组,我是否想念一个东西?...

➜  page php artisan tinker
Psy Shell v0.9.8 (PHP 7.1.16 — cli) by Justin Hileman
>>> $page = App\PageAtribut::where('page_id', '<', 2)->get()
=> Illuminate\Database\Eloquent\Collection {#2858
     all: [
       App\PageAtribut {#2844
         id: 1,
         page_id: 1,
         watchable_id: 1,
         watchable_type: "App\Category",
         created_at: "2018-09-11 11:03:20",
         updated_at: "2018-09-11 11:03:20",
       },
       App\PageAtribut {#2861
         id: 2,
         page_id: 1,
         watchable_id: 2,
         watchable_type: "App\User",
         created_at: "2018-09-11 11:03:40",
         updated_at: "2018-09-11 11:03:40",
       },
     ],
   }
>>> $page = App\PageAtribut::where('page_id', '==', 1)->get()
=> Illuminate\Database\Eloquent\Collection {#2846
     all: [],
   }
>>>
php laravel-5.5
2个回答
2
投票

只需使用一个,=。在laravel雄辩中没有==这样的东西。


0
投票

你需要使用单个'='。 close中使用的比较规则是mysql而不是php。

© www.soinside.com 2019 - 2024. All rights reserved.