search

Home  >  Q&A  >  body text

PHP采用正则表达式提取四列数据存成数组将数据批量导入mysql数据库中

PHP采用正则表达式提取四列数据,存成数组,将数据批量导入mysql数据库中

>>>>[0601_Access_S5352]dis arp
>>>>IP ADDRESS      MAC ADDRESS  EXPIRE(M) TYPE INTERFACE      VPN-INSTANCE
>>>>--------------------------------------------------------------------------
>>>>192.168.66.11   0016-413e-0c62         SF-  GE0/0/23                 66
>>>>192.168.66.13   0019-b906-e2ec         S--  GE0/0/18                 66
>>>>192.168.66.15   0019-b906-be56         S--  GE0/0/16                 66
>>>>192.168.66.17   0018-8b1e-96df         SF-  GE0/0/45                 66*

给一段代码吧,想提取ipaddress,macaddress,interface,vpninstance 四段数据

写入mysql数据库,是多行的,

>>>>insert into ip_interface (ipaddress,macaddress,interface,vpn) values ('192.168.66.11','0016-413e-0c62','GE0/0/23','66');*
PHPzPHPz2788 days ago746

reply all(2)I'll reply

  • phpcn_u38476

    phpcn_u384762017-10-02 23:54:03

    PHP uses regular expressions to extract four columns of data and save them into arrays to batch import the data into the mysql database


    reply
    0
  • phpcn_u38476

    phpcn_u384762017-10-02 23:53:48

    PHP uses regular expression v to extract four columns of data and save them into arrays to batch import the data into the mysql database


    reply
    0
  • Cancelreply