123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- /**
- * Description of Resp
- * 应答体
- * @author jgao
- */
- class Resp {
- //put your code here
- /**
- * 应答数据
- * @var type
- */
- public $data = null;
- /**
- * 错误码
- * @var type
- */
- public $err = 0;
- /**
- * 错误消息
- * @var type
- */
- public $errMsg = "";
- function stringify() {
- return json_encode($this);
- }
- /**
- *
- * @param type $data
- * @return \Resp
- */
- static function ret($data) {
- $resp = new Resp();
- $resp->data = $data;
- return $resp;
- }
- /**
- *
- * @param type $err
- * @param type $msg
- * @return \Resp
- */
- static function err($err, $msg) {
- $resp = new Resp();
- $resp->err = $err;
- $resp->errMsg = $msg;
- return $resp;
- }
- }
|