123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- /**
- * Description of payResp.php
- * 返回值基类, 统一的序列化到字符串的方法, json_encode...
- * @version
- * 1.0.0 Created at 2017-12-22. by --gwang
- * @author gwang (mail@wanggangzero.cn)
- * @copyright ? 2017-12-22, SJZ LoyalSoft Corporation & gwang. All rights reserved.
- */
- class payResp {
- public $err = 0;
- public $ret = 1;
- public $msg = "OK";
- public static function ok($ret = 0) {
- $resp = new payResp();
- $resp->err = 0;
- $resp->ret = $ret;
- return $resp;
- }
- public static function err($err_no, $msg) {
- $resp = new payResp();
- $resp->err = $err_no;
- $resp->msg = $msg;
- return $resp;
- }
- public function __toString() {
- return $this->toString();
- }
- public function toString() {
- // var_dump(\JsonUtil::encode($this));
- $str = loyalsoft\JsonUtil::encode($this);
- return $str;
- // return \gzdeflate($str);
- }
- }
|