src/Mysqli.php
public function save($data = '', $value = null)
    {
        if (!$this->where) {
            return false;
        }

        $newField = '';
        if ($value !== null && !is_array($data)) {
            $value    = str_replace('\\', '\\\\', $value);
            $value    = str_replace('\'', '\\\'', $value);
            $newField = '`' . $data . '`=\'' . $value . '\'';
        } else {
            if (is_array($data)) {
                foreach ($data as $k => $v) {
                    if (is_array($v)) {
                        $v[0] = strtolower($v[0]);
                        if ($v[0] == 'add') {
                            $newField .= '`' . $k . '`  = `' . $k . '` + ' . $v[1] . ',';
                        } elseif ($v[0] == 'less') {
                            $newField .= '`' . $k . '`  = `' . $k . '` - ' . $v[1] . ',';
                        } elseif ($v[0] == 'concat') {
                            $newField .= '`' . $k . '`  = CONCAT(`' . $k . '`,\'\',\'' . str_replace('\'', '\\\'', $v[1]) . '\'),';
                        }
                    } else {
                        $v = str_replace('\\', '\\\\', $v);
                        $v = str_replace('\'', '\\\'', $v);
                        $newField .= '`' . $k . '`=\'' . $v . '\',';
                    }
                }
                $newField = substr($newField, 0, -1);
            } else {
                $newField = $field;
            }
        }

        $this->field = $newField;

        $this->_sql = 'UPDATE ' . $this->table . ' SET ' . $this->field;
        $this->_sql .= $this->where ? $this->where : '';

        $result = $this->query();
        return $result;
    }
public function save($data = '', $value = null)
    {
        if (!$this->where) {
            return false;
        }

        $newField = '';
        if ($value !== null && !is_array($data)) {
            $value    = str_replace('\\', '\\\\', $value);
            $value    = str_replace('\'', '\\\'', $value);
            $newField = '`' . $data . '`=\'' . $value . '\'';
        } else {
            if (is_array($data)) {
                foreach ($data as $k => $v) {
                    if (is_array($v)) {
                        $v[0] = strtolower($v[0]);
                        if ($v[0] == 'add') {
                            $newField .= '`' . $k . '`  = `' . $k . '` + ' . $v[1] . ',';
                        } elseif ($v[0] == 'less') {
                            $newField .= '`' . $k . '`  = `' . $k . '` - ' . $v[1] . ',';
                        } elseif ($v[0] == 'concat') {
                            $newField .= '`' . $k . '`  = CONCAT(`' . $k . '`,\'\',\'' . str_replace('\'', '\\\'', $v[1]) . '\'),';
                        }
                    } else {
                        $v = str_replace('\\', '\\\\', $v);
                        $v = str_replace('\'', '\\\'', $v);
                        $newField .= '`' . $k . '`=\'' . $v . '\',';
                    }
                }
                $newField = substr($newField, 0, -1);
            } else {
                $newField = $field;
            }
        }

        $this->field = $newField;

        $this->_sql = 'UPDATE ' . $this->table . ' SET ' . $this->field;
        $this->_sql .= $this->where ? $this->where : '';

        $result = $this->query();
        return $result;
    }
修改保存
@date   2017-03-19T16:20:24+0800
@author ChenMingjiang
@param  string                   $data [description]
@return [type]                         [description]