1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace app\common\util;
- use think\Log;
- class SingleObjectClass
- {
- protected $openLog=true;
-
- protected function writeln($info, $type = "debug")
- {
- if ($this->openLog) {
- Log::write(print_r($info, true), $type);
- }
- }
-
- protected function getResult($code, $data = null)
- {
- $result['code'] = $code;
- $result['msg'] = ActQuestionErrCode::$errInfo[$code];
- if ($data) {
- $result['data'] = $data;
- }
- return $result;
- }
-
- public static function instance()
- {
- static $_instance = array();
- $classFullName = get_called_class();
- if (!isset($_instance[$classFullName])) {
-
-
-
- $instance = $_instance[$classFullName] = new static();
- return $instance;
- }
- return $_instance[$classFullName];
- }
- }
|