php常用函数集
2024-08-26 08:05:58
网络请求:
/**
* 发起HTTPS请求
*/
function curl_post($url,$data=null,$header=null,$post=0)
{
//初始化curl
$ch = curl_init();
//参数设置
$res= curl_setopt ($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, $post);
if($post && !is_null($data))
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
if (!is_null($header))
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$result = curl_exec ($ch);
//连接失败
curl_close($ch);
return $result;
}
最新文章
- 例如筋斗云的效果,但不通过offset定位的flag标记
- MyCAT常用分片规则之分片枚举
- Don't make a promise when you are in Joy. Don't reply when you are Sad.Don't take decisions when you are Angry.Think Twice.Act Wise.
- 【Python】pip国内安装源
- Java内存区域-- 运行时数据区域
- eclipse中配置c++开发环境 Eclipse + CDT + MinGW
- Python常用模块中常用内置函数的具体介绍
- kubectl自动补全
- ModelSerializer Meta设置
- H5的使用
- Ubuntu16.04 appstreamcli错误
- Memcache_分布式缓存
- char与unsigned char的区别
- HDU 5236 Article(概率DP)
- Delphi中break,exit,abort跳出循环的比较
- function, new function, new Function
- tcp连接的状态变迁以及如何调整tcp连接中处于time_wait的时间
- Python print() 函数
- StringBuffer类和String 类的 equals 和 ==
- 初探 hexo博客