Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在laravel中搜索json数组对象_Php_Mysql_Arrays_Json_Laravel 5.6 - Fatal编程技术网

Php 如何在laravel中搜索json数组对象

Php 如何在laravel中搜索json数组对象,php,mysql,arrays,json,laravel-5.6,Php,Mysql,Arrays,Json,Laravel 5.6,要使用Laravel从MYSQL搜索JSON中的对象,请执行以下操作: $parent = DB::table($this->table) ->where("right_children->parent", $firstParent) ->get(); 现在的问题是如何在数组中搜索对象 [ { "parent": "fish", "children": { "right":

要使用Laravel从MYSQL搜索JSON中的对象,请执行以下操作:

 $parent = DB::table($this->table)
                ->where("right_children->parent", $firstParent)
                ->get();
现在的问题是如何在数组中搜索对象

[
    {   "parent": "fish", 
        "children": { "right": "nunu"}
    }, 
    {   "parent": "cat", 
        "children": {"right": "nonha"}
    }
]
如果我想找到“努努”这个名字,我该如何使用laravel搜索它? 我试过这个:

DB::table($this->table)
  ->whereJsonContains("right_children->children->right", $firstParent)
  ->get();

但是没有结果,我知道我看错了

我想,通过阅读Laravel手册
,其中JSONContains
是专门针对SQL Server的,而不是MySQL@RiggsFolly换句话说,通过原始mysql比Laravel做得更好?不一定。我不是拉威尔专家,但这可能对你有帮助