php 网络请求 get请求和post请求
微信小程序开发交流qq群 173683895
承接微信小程序开发。扫码加微信。
代码记录
<?php
header('content-type:application:json;charset=utf8');
header('Access-Control-Allow-Origin:*');
//header('Access-Control-Allow-Methods:POST');
header('Access-Control-Allow-Headers:x-requested-with,content-type');//访问小程序获取二维码图片试试,听说是二进制图片qd_code_dsh();//多店铺二维码 一店一码function qd_code_dsh(){$arr = array('path' => '/pages/index/index?dsh_id=1','width' => 430,'scene' => 0);$path = json_encode($arr);$post_data=$path;$url="https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=".get_accessToken();//$url="https://api.weixin.qq.com/wxa/getwxacode?access_token=".get_accessToken();$result=api_notice_increment($url,$post_data);echo $result;}function api_notice_increment($url, $data){$ch = curl_init();$header = "Accept-Charset: utf-8";curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_AUTOREFERER, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, $data);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$tmpInfo = curl_exec($ch);// var_dump($tmpInfo);// exit;if (curl_errno($ch)) {return false;}else{// var_dump($tmpInfo);return $tmpInfo;}}/* 调用微信api,获取access_token,有效期7200s -xzz0704 */function get_accessToken(){/* 直接返回access_token */$result = curl_get_https("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wxdcdbc3696ede3ec5&secret=b57a681d90f5d8552c1486831241c950");$res = json_decode($result,true); //json字符串转数组if($res){return $res['access_token'];}else{return 'api return error';}}function curl_get_https($url){$curl = curl_init(); // 启动一个CURL会话curl_setopt($curl, CURLOPT_URL, $url);curl_setopt($curl, CURLOPT_HEADER, 0);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查//curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, true); // 从证书中检查SSL加密算法是否存在$tmpInfo = curl_exec($curl); //返回api的json对象//关闭URL请求curl_close($curl);return $tmpInfo; //返回json对象}
?>
相关文章:

docker查看现有容器_如何使用Docker将现有应用程序推送到容器中
docker查看现有容器by Daniel Newton丹尼尔牛顿 如何使用Docker将现有应用程序推送到容器中 (How to shove an existing application into containers with Docker) I have finally got round to learning how to use Docker past the level of knowing what it is and does w…

巧妙使用Firebug插件,快速监控网站打开缓慢的原因
巧妙使用Firebug插件,快速监控网站打开缓慢的原因 原文 巧妙使用Firebug插件,快速监控网站打开缓慢的原因 很多用户会问,我的网站首页才50KB,打开网页用了近60秒才打开?如何解释? 用户抱怨服务器运行缓…

第二阶段第三次站立会议
昨天做了什么:写了部分购物车的功能 今天要干什么:修改后台代码的错误 遇到的困难:没有困难转载于:https://www.cnblogs.com/jingxiaopu/p/7109774.html

微信小程序生成小程序二维码 php 直接可以用
微信小程序开发交流qq群 581478349 承接微信小程序开发。扫码加微信。 小程序需要先上线才能生成二维码 HTTP请求的效果图: 小程序展示的效果图: 小程序展示二维码源码: 请求二维码图片base64路径,点击预览图片 onLoad: func…

vue和react相同点_我在React和Vue中创建了相同的应用程序。 这是区别。
vue和react相同点by Sunil Sandhu由Sunil Sandhu 我在React和Vue中创建了相同的应用程序。 这是区别。 (I created the same app in React and Vue. Here are the differences.) Having used Vue at my current workplace, I had a fairly solid understanding of how it all …

Filter(过滤器)
一、Filter过滤器(重要) Javaweb中的过滤器可以拦截所有访问web资源的请求或响应操作。 1、Filter快速入门 1.1、步骤: 1. 创建一个类实现Filter接口 2. 重写接口中方法 doFilter方法是真正过滤的。 3. 在web.xml文件中配置 …

css3实现3D立体翻转效果
1、在IE下无法显示翻转效果,火狐和谷歌可以 1 /*样式css*/2 3 .nav-menu li {4 display: inline;5 }6 .nav-menu li a {7 color: #fff;8 display: block;9 text-decoration: none;10 overflow: visible;11 line-height: 40px;12 font-…

Ant Design 入门-参照官方文档使用组件
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 先来一个按钮组件使用的对比,官方文档的(不能直接用)和实际能用的。 官网demo: import { Table, Divider, Tag } from antd;const columns = [{title: Name,dataIndex: name,key: name,render: text =…

如何用JavaScript的回调函数做出承诺
by Adham El Banhawy由Adham El Banhawy 如何用JavaScript的回调函数做出承诺 (How to make a Promise out of a Callback function in JavaScript) Back-end developers run into challenges all the time while building applications or testing code. As a developer who …

VMware里的linux系统里的命令行里会有bee的声音,要如何关掉
VMware里的linux系统里的命令行里会有bee的声音,要如何关掉 取消bell报警声的方法:登陆linux系统vi /etc/inputrc找到set bell-style none 将前面的#去掉,之后重启系统即可解决声音问题若不见效可以通过下面的方式解决下bell-styl…

React-Todos
最近学完React的最基本概念,闲下来的时候就自己写了一个Todo-List的小应用。这里做个简略的说明,给想好好学React的新手看。 React-Todo 学习前提 这里我用了webpackb做了babel和JSX预处理和模块打包。所以对React和一些ES2015(ES6࿰…

Ant Design 入门-引用自己命名的组件
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 自己创建的组件:代码 import { Table, Divider, Tag } from antd; import React, { Component } from react; export default class My_Table extends Component {render() {const columns = [{title: …

迷宫出路代码_如何在软件开发的迷宫中找到自己的出路
迷宫出路代码by Tim Kleier蒂姆克莱尔(Tim Kleier) 如何在软件开发的迷宫中找到自己的出路 (How to find your way through the corn maze of software development) The corn maze is one of my favorite challenges to tackle. It’s an unnerving experience, especially w…

打包 React 项目并在服务器运行。
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 1.找到项目根目录的package.json文件:如图: 2.打开cmd执行:npm run build 3.生成DIST文件夹。 4.把DIST文件放到服务器phpStudty根目录,访问index.html。…

一些有用的Python问题
1. 修改IDLE工作路径,在命令交互模式下输入如下指令: >>> import os >>> os.getcwd() #查看当前的工作路径 >>> os.chdir(E:\\Python\\Demo) #修改当前的工作路径 2.Python中 ImportError: cannot import name NUMPY_MKL 的…

Python核心编程笔记---- print
在仅用变量名时,输出的字符串是用单引号括起来的。这个是为了让非字符串对象也可能以字符的形式显示在屏幕上。 而print 函数打印出来的是变量的值。 print 调用的是str()方法。而仅用变量名时调用的是repr()方法。 证明:------------------------------…

latex 插图解释_大O符号-只需插图和视频即可解释
latex 插图解释Big O notation is used to communicate how fast an algorithm is. This can be important when evaluating other people’s algorithms, and when evaluating your own! In this article, I’ll explain what Big O notation is and give you a list of the m…

[YTU]_2002(C语言实验——单词统计)
Description 从键盘输入一行字符,统计其中单词的个数,各单词以空格分隔,且空格数可以是多个。Input 输入只有一行句子。仅有空格和英文字母构成。 Output 单词的个数。 Sample Input stable marriage problem Consists of Matching memb…

资本中国人物-金融
一、二、三、店、五、土地、七、八、玖、拾起、白、千、一万、一亿、元(圆)、角、支、零、整个。这是上图中我们经常要填写。问:什么是它用数词?想必很多人都不是很清楚! 请看下面的两个相关的表数词: 1、数字化和大、小写数字对照…

Ant Design Pro 网络请求流程
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 在 Ant Design Pro 中,一个完整的前端 UI 交互到服务端处理流程是这样的: UI 组件交互操作; 调用 model 的 effect; 调用统一管理的 service 请求函数&a…

在Google Cloud Platform上持续部署Node.js
by Gautam Arora由Gautam Arora 在Google Cloud Platform上持续部署Node.js (Continuous Deployment for Node.js on the Google Cloud Platform) Google Cloud Platform (GCP) provides a host of options for Node developers to easily deploy our apps. Want a managed ho…

hdu-1108 最小公倍数
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid1108 题目类型: 数论 题意概括: 求两个数的最小公倍数 解题思路: 模拟 题目: 最小公倍数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/O…

sql-schema与catalog
schema: 指的是说当偶create database caiceclb时,caiceclb就是一个schema catalog: 指的是所有的database目录,就像上图显示的那样,将MySQL原来的(mysql,infomation_schema)及后来新建的的data…

这是如何更好地利用JavaScript数组的方法
by pacdiv由pacdiv 这是如何更好地利用JavaScript数组的方法 (Here’s how you can make better use of JavaScript arrays) Quick read, I promise. Over the last few months, I noticed that the exact same four mistakes kept coming back through the pull requests I c…

07、C语言——函数
函数 1、函数定义 函数返回值类型 函数名(形式参数列表) { 函数体; } 注意: 定义有参函数时,形参的定义可以采用传统方式或现代方式两种 1)传统方式: int …

This is probably not a problem with npm. There is likely additional logging output above
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 E:\weii_objct\invoice-manage-web-view>npm start > ant-design-pro@2.1.0 start E:\weii_objct\invoice-manage-web-view > cross-env APP_TYPE=site umi dev cross-env 不是内部或外部命令…

parcel react_如何使用Parcel捆绑React.js应用程序
parcel reactby Michael Ozoemena迈克尔奥索埃梅纳(Michael Ozoemena) 如何使用Parcel捆绑React.js应用程序 (How to use Parcel to bundle your React.js application) 什么是包裹? (What’s Parcel?) Parcel is a web application bundler which offers a blazi…

SparkSQL 与 Spark Core的关系
不多说,直接上干货! SparkSQL 与 Spark Core的关系 Spark SQL构建在Spark Core之上,专门用来处理结构化数据(不仅仅是SQL)。 Spark SQL在Spark Core的基础上针对结构化数据处理进行很多优化和改进, 简单来讲: Spark SQ…

linux操作系统-设置静态ip
在使用linux虚拟机的时候因为经常有关机的需求,然后重新开机后可能面临这上一次获取的ip被改变,在这里我分享一下在linux 下设置静态ip的经验 1.查看路由状态 [rootlocalhost ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Met…

判断数组里面的下标是否等于一个字符串
微信小程序开发交流qq群 173683895 承接微信小程序开发。扫码加微信。 使用includes() 1、判断字符串里面是否包含一个字符串 示例: var a aaaaaaaavconsole.log(a.includes(v)); //truevar a aaaaaaaavconsole.log(a.includes(c)); //falsevar a aa…