• 认证服务号Thinkphp微信支付


    公众号配置

    1.微信支付过程中需要获取用户的openid,所以,仍需填写 网页授权域名

    这里写图片描述

    2.微信支付授权目录

    这里写图片描述 
    Thinkphp目录格式为www.xxx.cn/home/wxpay/ 
    这里目录不能填写index.PHP,否则保存后域名会被过滤,index.php后面的内容直接处理掉。因此要求我们网站需配置为隐藏index.php也可访问的状态——URL Rewrite。 
    sae下隐藏url: 
    (1)项目模块下的config.php文件,URL_MODEL =>2; 
    (2)config.yaml文件:

    handle:
     - rewrite: if(!is_dir() && !is_file() && path~"^(.*)$") goto "index.php/$1"
     

    使用网站管理助手(v4.0)的服务器(iis7.0+php扩展): 
    rewrite使用选择diy,生成的web.config文件内容:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
        <rewrite>
     <rules>
     <rule name="OrgPage" stopProcessing="true">
     <match url="^(.*)$" />
     <conditions logicalGrouping="MatchAll">
     <add input="{HTTP_HOST}" pattern="^(.*)$" />
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
     </conditions>
     <action type="Rewrite" url="index.php/{R:1}" />
     </rule>
     </rules>
     </rewrite>
       </system.webServer>  
    </configuration>

    Wampserver集成环境 
    在Apache里开启rewrite模块扩展后,或服务器默认已支持该扩展后, 
    根目录下.htaccess文件:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    
    #不显示index.php
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    
    </IfModule>

    微信支付v2项目完整包

    文件目录 
    这里写图片描述 
    代码已传至csdn资源:http://download.csdn.net/detail/afanxingzhou/9548861 
    注意: 
    微信支付的金额单位为 ,使用时注意*100.0; 
    前台文件有一句<include file="Public_wap/wxshare_hide"/>,详细说明请参看博文 
    http://blog.csdn.net/afanxingzhou/article/details/51638047 

    该文件源码:

    <?php
    include('jssdk.php');
    $jssdk = new JSSDK(C('APPID'), C('SECRET'));
    if(isWeixinBrowser()){
    $signPackage = $jssdk->GetSignPackage();
    }
    ?>
    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
    wx.config({
        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
        appId: '<?php echo $signPackage["appId"];?>', // 必填,公众号的唯一标识
        timestamp: <?php echo $signPackage["timestamp"];?>, // 必填,生成签名的时间戳
        nonceStr: '<?php echo $signPackage["nonceStr"];?>', // 必填,生成签名的随机串
        signature: '<?php echo $signPackage["signature"];?>',// 必填,签名,见附录1
        jsApiList: [
            'hideMenuItems'
    
                    ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
    });
    wx.ready(function () {
    
          // 1 判断当前版本是否支持指定 JS 接口,支持批量判断
    
            wx.checkJsApi({
    
              jsApiList: [
    
                'hideMenuItems'
    
              ],
    
              /* success: function (res) {
    
                alert(JSON.stringify(res));
    
              } */
    
    
            });
    
            wx.hideOptionMenu();
    
        });
    
        /* wx.error(function (res) {
    
          alert(res.errMsg);
    
        });  */
    </script>

    支付截图

    这里写图片描述


    这里写图片描述


    这里写图片描述


    这里写图片描述


    这里写图片描述

    出处:blog.csdn.NET/afanxingzhou 

  • 相关阅读:
    Web HTML 内容改变的触发事件方式
    Delphi Clipboard[2] SetTextBuf、GetTextBuf、AsText 文本操作
    Delphi 绘图TCanvas类[4] TBrush 参数及介绍
    Delphi Clipboard[3] HasFormat、Assign及Image图片的加载
    Delphi WinAPI Window Styles窗体风格
    Delphi Clipboard[1] 剪贴板 介绍
    Delphi WinAPI SetLayeredWindowAttributes设置分层窗口的不透明度和透明度颜色关键点
    C++基础入门
    mysql怎么导入sql文件
    解决ubuntu20.04下vi编辑器方向键和退格键问题
  • 原文地址:https://www.cnblogs.com/houdj/p/6768199.html
Copyright © 2020-2023  润新知