对于PHP中的LINQ,我使用了https://github.com/Athari/YaLinqo我不知道如何在where子句中传递变量。publicfunctionfilter($arr,$find){Enumerable::from($arr)->where(function($val){returnstripos($val->item,$find)>-1;})->toArray();}似乎没有像$find未定义一样工作,但我将它作为方法的参数发送。 最佳答案 您可以使用use语句:Enumerable::from($arr)-