【发布时间】:2016-12-06 05:55:36
【问题描述】:
我提到了一个关于这个话题的奇怪问题。我自己“解决”了它,但想讨论是否有人理解这背后的问题。
此查询适用于 php 7.0:
$image = (ProductImage::all()->where('productHistory_id', $product->history_id))->first();
并导致syntax error, unexpected '->' (T_OBJECT_OPERATOR)。
此查询(不带括号)适用于 php 7.0 和 5.6:
$image = ProductImage::all()->where('productHistory_id', $product->history_id)->first();
哇?!
亲切的问候, 妮可
【问题讨论】:
标签: php laravel eloquent version