Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.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 stdClass对象变量中的多重搜索?_Php_Arrays_Object_Stdclass - Fatal编程技术网

Php stdClass对象变量中的多重搜索?

Php stdClass对象变量中的多重搜索?,php,arrays,object,stdclass,Php,Arrays,Object,Stdclass,我正在用JSON设计一个数据库系统(php类),我想在变量对象stdClass中执行一个多准则搜索功能(单个条件没有问题),我被阻止了:-( 对于我创建了一个php类的系统,下面是使用单个条件进行搜索的函数 public function RechercheEnregistrementCritere($champ,$critere){ $retour=array(); $datas = $this->ToutEnregistrement(); foreach ($datas as $key

我正在用JSON设计一个数据库系统(php类),我想在变量对象stdClass中执行一个多准则搜索功能(单个条件没有问题),我被阻止了:-(

对于我创建了一个php类的系统,下面是使用单个条件进行搜索的函数

public function RechercheEnregistrementCritere($champ,$critere){
$retour=array();
$datas = $this->ToutEnregistrement();
foreach ($datas as $key => $row) {
    if($row->$champ == $critere ){$retour[]=$row;}  
}return $retour;}  
我想创建一个类似的函数,但带有一个数组变量参数


你能帮我吗?提前谢谢

我正在设计一个数据库系统(php类)在JSON中。很抱歉,但毫无意义。我不知道你在说什么,但只需对$champ+$critere数组执行相同的操作,然后在函数中循环遍历数组,执行相同的操作并返回anwser数组?这是一个平面数据库(nosql),因此有意义:-)该系统是一个php类,用于处理JSON格式的数据。如果这毫无意义,那么为什么Vmware开发了Redis、Microsoft开发了Azure Cosmos和Amazon SimpleDB?
public function RechercheEnregistrementCritere($champ,$critere){
$retour=array();
$datas = $this->ToutEnregistrement();
foreach ($datas as $key => $row) {
    if($row->$champ == $critere ){$retour[]=$row;}  
}return $retour;}