本帖最后由 lzh68575536 于 2022-10-27 14:42 编辑
[PHP] 纯文本查看 复制代码 $arr=[
'1'=>[
'https://www.baidu.com',
'https://www.qq.com',
'https://www.jd.com',
'https://www.taobao.com',
'https://www.1688.com',
'https://www.goog.com',
],
'2'=>[
'https://www.baidu1.com',
'https://www.qq1.com',
'https://www.jd1.com',
'https://www.taobao1.com',
'https://www.16881.com',
'https://www.goog1.com',
],
'3'=>[
'https://www.baidu2.com',
'https://www.qq2.com',
'https://www.jd2.com',
'https://www.taobao2.com',
'https://www.16882.com',
'https://www.goog2.com',
],
'4'=>[
'https://www.baidu3.com',
'https://www.qq3.com',
'https://www.jd3.com',
'https://www.taobao3.com',
'https://www.16883.com',
'https://www.goog3.com',
],
];
$sqlDate = [];
foreach($arr as $key=>$value){
foreach($value as $val){
$data = [
'page'=>$key,
'url'=>$val,
];
$sqlDate[] = $data;
}
//$sqlDate[] = $data;//上一版问题
}
Db::name('xxxx')->insertAll($sqlDate); |