公告:网站目录为广大站长提供免费收录网站服务,VIP会员每天提交网站30、文章30免审核,快审服务(10元/站),可自助充值发布。

点击这里在线咨询客服 点击这里在线咨询客服

自7月13日起【本站免费收录】所有正规网站,当天提交,当天审核!时间有限!本店已经开通熊账号,网站内容当天收率,不容错过!

新站提交
  • 网站:9300
  • 待审:120
  • 小程序:22
  • 文章:7633
  • 会员:20

用的是ECSHOP商城框架,在本地测试(windows7系统)的时候,正常交易。但是到了生产环境(Centos系统)后,支付宝就报ILLEGAL_SIGN(签名验证错误)错误。网上看多解决方法,但是都没作用。下面是生成的支付宝支付代码的代码: 

<code>    function get_code($order, $payment)

    {

        if (!defined('EC_CHARSET'))

        {

            $charset = 'utf-8';

        }

        else

        {

            $charset = EC_CHARSET;

        }

 

        $real_method = $payment['alipay_pay_method'];

 

        switch ($real_method){

            case '0':

                $service = 'trade_create_by_buyer';

                break;

            case '1':

                $service = 'create_partner_trade_by_buyer';

                break;

            case '2':

                $service = 'create_direct_pay_by_user';

                break;

        }

 

 

        $parameter = array(

            'agent'             => $payment['alipay_agent'],

            'service'           => $service,

            'partner'           => $payment['alipay_partner'],

            //'partner'           => ALIPAY_ID,

            '_input_charset'    => $charset,

            'notify_url'        => return_url(basename(__FILE__, '.php')),

            'return_url'        => return_url(basename(__FILE__, '.php')),

            /* 业务参数 */

            'subject'           => $order['order_sn'],

            'out_trade_no'      => $order['order_sn'] . $order['log_id'],

            'extra_common_param'=> !empty($order['all_pay'])?$order['all_pay']:0, //判断是不是合并付款 add by ouzhiming

            'price'             => $order['order_amount'],

            'quantity'          => 1,

            'payment_type'      => 1,

            /* 物流参数 */

            'logistics_type'    => 'EXPRESS',

            'logistics_fee'     => 0,

            'logistics_payment' => 'BUYER_PAY_AFTER_RECEIVE',

            /* 买卖双方信息 */

            'seller_email'      => $payment['alipay_account']

        );

 

        ksort($parameter);

        reset($parameter);

 

        $param = '';

        $sign  = '';

 

        foreach ($parameter AS $key => $val)

        {

            $param .= "$key=" .urlencode($val). "&";

            $sign  .= "$key=$val&";

        }

 

        $param = substr($param, 0, -1);

        $sign  = substr($sign, 0, -1).$payment['alipay_key'];

        //$sign  = substr($sign, 0, -1). ALIPAY_AUTH;

 

        $button = '<div style="text-align:center"><input type="button" class="pay_button" onclick="window.open(\'https://www.alipay.com/cooperate/gateway.do?'.$param. '&sign='.md5($sign).'&sign_type=MD5\')" value="' .$GLOBALS['_LANG']['pay_button']. '"></div>';

 

        return $button;

    }

</code>

<code>    function get_code($order, $payment)

    {

        if (!defined('EC_CHARSET'))

        {

            $charset = 'utf-8';

        }

        else

        {

            $charset = EC_CHARSET;

        }

 

        $real_method = $payment['alipay_pay_method'];

 

        switch ($real_method){

            case '0':

                $service = 'trade_create_by_buyer';

                break;

            case '1':

                $service = 'create_partner_trade_by_buyer';

                break;

            case '2':

                $service = 'create_direct_pay_by_user';

                break;

        }

 

 

        $parameter = array(

            'agent'             => $payment['alipay_agent'],

            'service'           => $service,

            'partner'           => $payment['alipay_partner'],

            //'partner'           => ALIPAY_ID,

            '_input_charset'    => $charset,

            'notify_url'        => return_url(basename(__FILE__, '.php')),

            'return_url'        => return_url(basename(__FILE__, '.php')),

            /* 业务参数 */

            'subject'           => $order['order_sn'],

            'out_trade_no'      => $order['order_sn'] . $order['log_id'],

            'extra_common_param'=> !empty($order['all_pay'])?$order['all_pay']:0, //判断是不是合并付款 add by ouzhiming

            'price'             => $order['order_amount'],

            'quantity'          => 1,

            'payment_type'      => 1,

            /* 物流参数 */

            'logistics_type'    => 'EXPRESS',

            'logistics_fee'     => 0,

            'logistics_payment' => 'BUYER_PAY_AFTER_RECEIVE',

            /* 买卖双方信息 */

            'seller_email'      => $payment['alipay_account']

        );

 

        ksort($parameter);

        reset($parameter);

 

        $param = '';

        $sign  = '';

 

        foreach ($parameter AS $key => $val)

        {

            $param .= "$key=" .urlencode($val). "&";

            $sign  .= "$key=$val&";

        }

 

        $param = substr($param, 0, -1);

        $sign  = substr($sign, 0, -1).$payment['alipay_key'];

        //$sign  = substr($sign, 0, -1). ALIPAY_AUTH;

 

        $button = '<div style="text-align:center"><input type="button" class="pay_button" onclick="window.open(\'https://www.alipay.com/cooperate/gateway.do?'.$param. '&sign='.md5($sign).'&sign_type=MD5\')" value="' .$GLOBALS['_LANG']['pay_button']. '"></div>';

 

        return $button;

    }

</code>

如果出现ILLEGAL_SIGN错误,可以切换下PHP版本,7.0以上的都会报错,切回7.0以下即可

分享到:

  everest

注册时间:

网站:0 个   小程序:3 个  文章:12 篇

  • 9300

    网站

  • 22

    小程序

  • 7633

    文章

  • 20

    会员

赶快注册账号,推广您的网站吧!
热门网站
最新入驻小程序

淘折扣优惠券2019-08-11

淘折扣旨在为大家提供物美价廉的

美团外卖2019-07-16

美团外卖小程序介绍 美团外卖,目

WordPress中文网2019-07-16

WordPress中文网小程序介绍: 1、

精品PPT模板免费下载2019-07-10

提供各类PPT模板免费下载,PPT大全

58同城2019-07-04

58同城为你提供本地生活服务信息

新影视网2019-06-26

新影视网- 在线观看高清电影电视