The code contains oneline data and twoline data, and how to combine the two sets of data

Source: Internet
Author: User
Tags addall
The code has oneline data and twoline data, how to combine the two sets of data together?
Public function Line ($config, $qq = ", $data =array ()) {
$array = Array ();
$line = $config [' line '];
$url = Trim ($config [$line]);
if ($line = = ' Oneline ' && $qq! = ') {
$content = $this->progetcont ($url. ' /index.php?m=account&c=index&a=search&q= '. $qq);
Preg_match_all ('/([\s\s]*?) <\/tr>/i ', $content, $pregArray);
if (count ($pregArray)) {
foreach ($pregArray [0] as $value) {
Preg_match_all ('/ /I ', $value, $v);
$ipVal = $this->strsub ($v [0][3], ' fa ' > ', '');
$ipid = M (' iplib ')->where (' Ipval = \ '. $ipVal. ' \ ')->find () [' id '];
if (! $ipid) {
$ipid = M (' iplib ')->add (Array (' ipval ' = = $ipVal, ' namelist ' = ' 1 '));
}
$timsInt = Strtotime ($this->strsub ($v [0][4], ' fa ' > ', ''));
$boolTure =true;
foreach ($data as $d) {
if ($d [' jbtime '] = = $timsInt) && ($ipid = = $d [' Jbip '])) {
$boolTure = false;
}
}
if ($boolTure | | count ($data) ==0) {
$array [] = Array (
' Jbip ' = $ipid,
' Jbtime ' = $timsInt,
' Number ' = $qq,
' Class ' = ' 1 ',
' Type ' = ' 4 ',
' Whitelist ' = ' 0 '
);
}

}
$rel = M (' number ')->addall ($array);
}

}

if ($line = = ' Twoline ') {
= ";
$class = ' 1 ';
if ($qq! = ") {
if (!is_numeric ($QQ) | | (Strlen ($QQ) < 5) | | (strlen ($QQ) > 13)) {
$this->error (' The QQ number you queried is in the wrong format! ');
return $data;
}
$content = $this->progetcont ($url. ' /form.php ', ' qq= '. $qq);
= $QQ;

}

if ($content) {

$type = M (' type ')->select ();
$typeArray = Array ();
foreach ($type as $v) {
$typeArray [Trim ($v [' name '])] = $v [' id '];
}

Preg_match_all ('/{([\s\s]*?)} /I ', $content, $pregArray);
if (count ($pregArray)) {
foreach ($pregArray [0] as $k = + $value) {
$ipVal = $this->strsub ($value, ' myip ': ', ', ' Date ');
$ipVal = Str_replace (' "', ' ', $ipVal);
$ipid = M (' iplib ')->where (' Ipval = \ '. $ipVal. ' \ ')->find () [' id '];
if (! $ipid) {
$ipid = M (' iplib ')->add (Array (' ipval ' = = $ipVal, ' namelist ' = ' 1 '));
}
$timsInt = Strtotime ($this->strsub ($value, ' Date ': ' ', ' ', ' TypeText '));
$boolTure =true;
foreach ($data as $d) {
if ($d [' jbtime '] = = $timsInt) && ($ipid = = $d [' Jbip '])) {
$boolTure = false;
}
}
if ($boolTure | | count ($data) ==0) {
$array [$k] [' jbip '] = $ipid;
$array [$k] [' jbtime '] = $timsInt;
if ($class = = ' 1 ') {
$type = Trim ($this->unicode_decode ($this->strsub ($value, ' TypeText ': "', '", "Qq1 ')));
}
if ($class = = ' 2 ') {
$type = Trim ($this->unicode_decode ($this->strsub ($value, ' TypeText ': "', '", "WW1 ')));
}
$array [$k] [' type '] = (array_key_exists ($type, $typeArray))? $typeArray [$type]: ' Other ';
$array [$k] [' number '] =;
$array [$k] [' class '] = $class;
$array [$k] [' whitelist '] = ' 0 ';
}
}
$rel = M (' number ')->addall ($array);
}
}
}
}


if (count ($array)) {
foreach ($array as $a) {
$data []= $a;
}
}

return $data;
}

The code contains oneline data and twoline data, how to put these two sets of data together, thank you!
------to solve the idea----------------------

$a = 1 2 3 4
$union = // $b = 2 4 5 6
Array_merge (
Array_intersect ($a, $b), // 2 4
Array_diff ($a, $b), // 1 3
Array_diff ($b, $a) // 5 6
); $u = 1 2 3 4 5 6
?>

------to solve the idea----------------------
Two pieces of data are written in the $array.
But the second paragraph might cover the first paragraph.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.