<?php
//太平洋网络查询ip,较快
$ip = "14.117.179.49";
$get_ip_city = get_ip_city($ip);
var_dump($get_ip_city);
/**
*$ip string 必传
*获取ip归属地
*demo 广东省江门市 电信
*/
function get_ip_city($ip){
$ch = curl_init();
$url = 'https://whois.pconline.com.cn/ipJson.jsp?ip='.$ip;
//用curl发送接收数据
curl_setopt($ch, CURLO...
$redis = new \Redis();
$redis->connect('127.0.0.1', 6379); //6379端口号
//使用string类型
$redis->delete("string1");
$redis->set('string1','val1');
$val = $redis->get('string1');
var_dump($val);
$redis->set('string1',5);
$redis->incr('string1',3);
$val = $redis->get('string1');
var_dump($val);
//使用list类型
$redis->delete("list1");
$redis->lpush("list1","a");
$redis->lpush("list1","b");
$redi...
echo date("Y-m-d",strtotime("+1 month",strtotime("2011-02-04")));
结果为:2011-03-04
echo date("Y-m-d",strtotime("+1 week",strtotime("2011-02-04")));
结果为:2011-02-11
echo date("Y-m-d",strtotime("+1 day",strtotime("2011-02-04")));
结果为:2011-02-05
使用函数 date() 实现
<?php echo $showtime=date("Y-m-d H:i:s");?>
显示的格式: 年-月-日 时:分:秒
相关时间参数:
a - "am" 或是 "pm"
...
// get方法请求
function getCurl($url) {//get https的内容
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //不输出内容
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
// post方法请求
function postCurl($url, $post) {//get https的内...
<?php
session_start();
/**
* [getWxAcsessToken 获取access_token]
* @return [type] [description]
*/
function getWxAcsessToken(){
$appid = "xxx";//开发者ID(AppID)
$appsecret = "xxx";//开发者密码(AppSecret)
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$appsecret;
//2.初始化
$ch = curl_init();
...
<?php
//注意导出csv文件之前不能输出任何数据,否则失败
header('content-type:text/html;charset=utf-8');
//1.数据库取出数据
$conn=mysql_connect('localhost','root','root');
mysql_select_db('blog');
mysql_set_charset('utf8');
$result=mysql_query('select * from blog_user');
$emps=array();
while($row=mysql_fetch_assoc($result)){
static $i=0;
$emps[$i] = $row;
$i++;
}
//设置内存占...
努力到无能为力,拼搏到感动自己
java myEclipse2017添加tomcat服务器 php使用redis redis类型与操作 php获取ip归属地 linux安装redis和redis扩展 cmd批量删除文件 Linux下mysql操作 一个人的旅途 PHP SFTP简单上传下载实现 基于PHP的微信公众平台开发(TOKEN验证,消息回复)
php获取ip归属地 PHP SFTP简单上传下载实现 基于PHP的微信公众平台开发(TOKEN验证,消息回复) php实现微信公众平台发红包功能 php使用redis redis类型与操作 linux安装redis和redis扩展 java myEclipse2017添加tomcat服务器 java Myeclipse 2017的安装 PHP中如何给日期加上一个月 加一周 加一天
Copyright © 2016-2019 709173702@qq.com 版权所有 ICP证:粤ICP备16117826号-1
联系邮箱:709173702@qq.com