查询王者荣耀英雄
error('@错误 :(');
}
if(!$seah && !$keyname && !$max && !$min)
{
print_r($data);exit;
}
//搜索名字
// print_r($data);
for ($i = 0; $i < count($data); $i++)
{
if($data[$i]['name']===$seah)
{
$d = '您的查询条件是 name:';
$success['name'] = $d.$seah;
$success[] = $data[$i];
}
//
if ($data[$i]['attack_range']===$seah)
{
$d = '您的查询条件是 attack_range:';
$success['attack_range'] = $d.$seah;
$success[] = $data[$i];
}
//
if ($data[$i]['role_main']===$seah)
{
$d = '您的查询条件是 role_main:';
$success['role_main'] = $d.$seah;
$success[] = $data[$i];
}
//
if ($data[$i]['role_assist']===$seah)
{
$d = '您的查询条件是 role_assist:';
$success['role_assist'] = $d.$seah;
$success[] = $data[$i];
}
}
$seah = !empty($success) ? 1:0;
if ($seah==1)
{
$succ['code'] = 1;
$succ['msg'] = '成功';
@$succ['name'] = !$success['name'] ? false : $success['name'];
@$succ['attack_range'] = !$success['attack_range'] ? false : $success['attack_range'];
@$succ['role_main'] = !$success['role_main'] ? false : $success['role_main'];
@$succ['role_assist'] = !$success['role_assist'] ? false : $success['role_assist'];
if($succ['name']==false) unset($succ['name']);
if($succ['attack_range']==false) unset($succ['attack_range']);
if($succ['role_main']==false) unset($succ['role_main']);
if($succ['role_assist']==false) unset($succ['role_assist']);
//去重
if(@$succ['role_assist'] && @$succ['role_main'])
{
unset($succ['role_main']);
}
if (@$succ['role_main'] && @$succ['attack_range'])
{
unset($succ['attack_range']);
}
if (@$succ['role_assist'] && @$succ['attack_range'])
{
unset($succ['attack_range']);
}
//赋给info
if (@$succ['name'])
{
$succ['info'] = $succ['name'];
unset($succ['name']);
}
if (@$succ['attack_range'])
{
$succ['info'] = $succ['attack_range'];
unset($succ['attack_range']);
}
if (@$succ['role_main'])
{
$succ['info'] = $succ['role_main'];
unset($succ['role_main']);
}
if (@$succ['role_assist'])
{
$succ['info'] = $succ['role_assist'];
unset($succ['role_assist']);
}
//多条结果
$p = count($success)>2 ?1:0;
if ($p==1)
{
for ($i = 0; $i < count($success)-2; $i++)
{
@$succ['data'][$i] = $success[$i];
}
}else{
$succ['data'] = $success[0];
}
if ($succ['data'][0])
{
$ount = count($succ['data']);
$succ['info'] = "已找到".$ount."条记录";
}else{
$succ['info'] = "已找到1条记录";
}
if ($type ==='array')
{
exit(print_r($succ));
}
return $succ;
}
// print_r($data);
for ($i = 0; $i < count($data); $i++)
{
if (@$mex == 'on' || @$min == 'on')
{
if ($max || $max == 'on' && $keyname)
{
$setmax[] = $data[$i][$keyname];
}
if ($min == 'on' && $keyname && $min)
{
$setmin[] = $data[$i][$keyname];
}
}
if($max!='on' || $min!='on')
{
if ($keyname && $max || $min)
{
if(!is_int($data[$i][$keyname]) && !is_float($data[$i][$keyname]))
{
exit('类型不匹配');
}else{
if ($data[$i][$keyname]===$max) {
$success[] = $data[$i];
}
if ($data[$i][$keyname]===$min) {
$success[] = $data[$i];
}
}
}
if ($keyname && $max && $min)
{
if(!is_int($data[$i][$keyname]) && !is_float($data[$i][$keyname]))
{
exit('类型不匹配');
}else{
if ($data[$i][$keyname]<$max && $data[$i][$keyname]>$min)
{
//echo "最大值最小值";
$success[] = $data[$i];
}
}
}
}
}
//print_r($setmax);
for ($i = 0; $i < count($data); $i++)
{
if (@$setmin)
{
$setmins = min($setmin);
$succ["info1"] = "最小值是".$setmins;//
if($data[$i][$keyname] == $setmins)
{
$succ[] = $data[$i];
}
}
if (@$setmax || @$max == 'on')
{
$setmaxs = max($setmax);
$succ["info2"] = "最大值是".$setmaxs;//
if($data[$i][$keyname] == $setmaxs)
{
$succ[] = $data[$i];
}
}
}
if ($succ) {
if (@$succ['info1'] && @$succ['info2'])
{
$ount = count($succ)-2;
}else{
$ount = count($succ)-1;
}
$succ['msg'] = "已找到".$ount."条记录";
return $succ;
}
@$succ['count'] = '已查找到'.count($success).'条记录';
@$succ['data'] = $success;
if (!$succ['data']) {
return false;
}
return $succ;
}
function index(){
}
function myAdd()
{
//$data['name'] = $name; //中文
//$data['hp_max'] = $hp_max;
//$data['hp_growth'] = $hp_growth;
//$data['hp_start'] = $hp_start;
//$data['mp_max'] = $mp_max;
//$data['mp_growth'] = $mp_growth;
//$data['mp_start'] = $mp_start;
//$data['attack_max'] = $attack_max;
//$data['attack_growth'] = $attack_growth;
//$data['attack_start'] = $attack_start;
//$data['defense_max'] = $defense_max;
//$data['defense_growth'] = $defense_growth;
//$data['defense_start'] = $defense_start;
//$data['hp_5s_max'] = $hp_5s_max;
//$data['hp_5s_growth'] = $hp_5s_growth;
//$data['hp_5s_start'] = $hp_5s_start;
//$data['mp_5s_max'] = $mp_5s_max;
//$data['mp_5s_growth'] = $mp_5s_growth;
//$data['mp_5s_start'] = $mp_5s_start;
//$data['attack_speed_max'] = $attack_speed_max;
//$data['attack_range'] = $attack_range; //远程
//$data['role_main'] = $role_main; //法师
//$data['role_assist'] = $role_assist; //坦克
//$data['birthdate'] = $birthdate; //日期
}
function myUpdate()
{
}
function myRDelete()
{
}
myAdd();
index();
$searh = myLolSearch('','','on');
//print_r($searh);
myUpdate();
myRDelete();