(编辑:jimmy 日期: 2025/11/10 浏览:2)
刚接触微信,要做一个在手机上的表单提交功能。
需求有这些:
因为每个手机在同一个公众号当中的openid是唯一性的。所以在手机查看这个表单页面的时候,就将这个openid存到数据库中,方便下次提交可以验证。
下面是我的代码。使用的是YII2框架。
Controller
//获得回调函数
public function actionCallback($code,$state){
$model = new tp_tstz_proposal();
$model1= new tp_tstz_staff();
// 微信开放平台网站应用的appid和秘钥secret
$appid = '';
$secret = '';
$curl = new curl\Curl();
//获取access_token
$wxresponse = $curl->get('https://api.weixin.qq.com/sns/oauth2/access_token"htmlcode">
header('Location:https://open.weixin.qq.com/connect/oauth2/authorize"htmlcode">
if(!isset($key)){
header('Location:http://jifen.wendu.cn/ts/web/index.php"color: #ff0000">总结
以上所述是小编给大家介绍的使用YII2框架实现微信公众号中表单提交功能,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!