这个 SQL 拼接实现了,如果数据库存在相同数据则 更新,不存在则插入 的 SQL 语句 具体实现就是第一个 for 循环,获取 key 作为 MySQL 字段名字、VALUES 做为 SQL 的 VALUES(拼接成一个插入的 SQL 语句) 第二个 for 循环,实现了 字段名 = VALUES 的拼接。 和第一个 for 循环的中的 sql 就组成了 insert into XXXXX on duplicate key update 这个。存在则更新 不存在则插入的 SQL 语句。 我只能所 6666666666 写这个拼接的小哥儿有想法。还挺通用。 不知道你们有没有想到这种方法 反正我是没想到。
来源:https://cuiqingcai.com/4244.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_11417.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57