1 Star 5 Fork 2

行者 / 接口数据自动入库(JSON2DB)

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
db_fun.php 523 Bytes
一键复制 编辑 原始数据 按行查看 历史
行者 提交于 2018-09-11 21:38 . 数据库连接文件
<?php
error_reporting(E_ERROR);
#连接数据库
$conn = mysqli_connect("localhost", "userid", "password", "dbname");
#判断是否连接成功
if (!$conn) {echo "失败";}
//选择数据库
mysqli_select_db($conn, '');
function get_data($url) {
$ch = curl_init();
$timeout = 30;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
PHP
1
https://gitee.com/adetion/json2db.git
git@gitee.com:adetion/json2db.git
adetion
json2db
接口数据自动入库(JSON2DB)
master

搜索帮助