The code contains oneline data and twoline data. how can we combine these two groups of data?

Source: Internet
Author: User
The code contains oneline data and twoline data. how can we combine these two groups of data?
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 ('/
 <\ td>
  
/I ', $ value, $ v); $ Marshal = $ this-> strSub ($ v [0] [3], 'fa "> ',''); $ Ipid = M ('iplib')-> where ('Marshal = \''. $ marshal. '\ '')-> find () ['id']; if (! $ Ipid) {$ ipid = M ('iplib')-> add (array ('marshal' => $ Marshal, '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 ('jobip' => $ ipid, 'jobtime' => $ timsInt, 'number' => $ qq, 'Class' => '1', 'type' => '4', 'whitelist' => '0');} $ rel = M ('number ') -> addAll ($ array) ;}}if ($ line = 'twoline') {$ number = ''; $ class = '1'; if ($ qq! = '') {If (! Is_numeric ($ qq) | (strlen ($ qq) <5) | (strlen ($ qq)> 13 )) {$ this-> error ('The format of your queried QQ number is incorrect! '); Return $ data;} $ content = $ this-> proGetCont ($ url. '/form. php', 'qq = '. $ qq); $ number = $ 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) {$ Marshal = $ this-> strSub ($ value, 'myip ": ','," date'); $ Marshal = str_replace ('"','', $ Marshal); $ ipid = M ('iplib')-> where ('Marshal = \''. $ marshal. '\ '')-> find () ['id']; if (! $ Ipid) {$ ipid = M ('iplib')-> add (array ('marshal' => $ Marshal, '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 ($ th Is-> 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]: 'Others'; $ array [$ k] ['Number'] = $ number; $ array [$ k] ['class'] = $ class; $ array [$ k] ['whitelist'] = '0 ';}} $ rel = M ('number')-> addAll ($ array) ;}}} if (count ($ array) {foreach ($ array as $) {$ data [] = $ a;} return $ data ;}
 <\>

The code contains oneline data and twoline data. how can we combine these two groups of data? thank you!


Reply to discussion (solution)

 

The data in the two segments is written to $ array, which is originally the same
However, the second part may overwrite

Let me try it first. Thank you two.

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.