Browse Source

为Prpcrypt类增加构造函数__construct(),以兼容php高版本
(感谢@yhostc 提出,fixed #194)

binsee 10 years ago
parent
commit
484dcf4927
2 changed files with 14 additions and 0 deletions
  1. 7 0
      qywechat.class.php
  2. 7 0
      wechat.class.php

+ 7 - 0
qywechat.class.php

@@ -2087,11 +2087,18 @@ class Prpcrypt
 {
     public $key;
 
+    /**
+     * 兼容老版本php构造函数
+     */
     function Prpcrypt($k)
     {
         $this->key = base64_decode($k . "=");
     }
 
+    function __construct($k) {
+        $this->key = base64_decode($k . "=");
+    }
+
     /**
      * 对明文进行加密
      * @param string $text 需要加密的明文

+ 7 - 0
wechat.class.php

@@ -3210,11 +3210,18 @@ class Prpcrypt
 {
     public $key;
 
+    /**
+     * 兼容老版本php构造函数
+     */
     function Prpcrypt($k)
     {
         $this->key = base64_decode($k . "=");
     }
 
+    function __construct($k) {
+        $this->key = base64_decode($k . "=");
+    }
+
     /**
      * 对明文进行加密
      * @param string $text 需要加密的明文