code: public function encode($data)
      {
          if ($this->isEmpty($data)) {
              return '{}';
          }
  
          $data = (array) $data + $this->defaults;
          $data = array_intersect_key($data, $this->defaults);
  
          return json_encode($data, JSON_UNESCAPED_SLASHES);
      }
docs: 转换数组为字符串供保存到数据库
  
  @param array $data
  @return string