1、腾讯股票数据控制器
<?php
namespace app\index\controller;
use think\Model;
use think\Db;
const BASE_URL = 'http://aaaaaa.aaaaa.com';
class TencentStocks extends Home
{
}
2、请求接口返回内容
function juhecurl($url, $params = false, $ispost = 0)
{
header('Content-Type:text/html; charset=gb_2312');
$httpInfo = array();
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_USERAGENT, 'JuheData');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if ($ispost) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt(<