Php stdClass对象变量中的多重搜索?
我正在用JSON设计一个数据库系统(php类),我想在变量对象stdClass中执行一个多准则搜索功能(单个条件没有问题),我被阻止了:-( 对于我创建了一个php类的系统,下面是使用单个条件进行搜索的函数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
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;}