core/Form.php
public function setValues(array $values = null, bool $force = false)
    {
        if ($values == null) {
            return;
        }
        $fields = $this->getFields();
        if (method_exists($this, 'beforeSetValues')) {
            $this->beforeSetValues($fields, $values);
        }
        if (isset($values['id'])) {
            $this->id = intval($values['id']);
        }
        foreach ($fields as $name => $field) {
            if ($field->close) {
                continue;
            }
            if (!$force && $field->value !== null) {
                continue;
            }
            $box = Field::getInstance($field->type);
            if ($box != null) {
                $box->init($field, $values);
            } else {
                $field->value = isset($values[$name]) ? $values[$name] : null;
            }
        }
        if (method_exists($this, 'afterSetValues')) {
            $this->afterSetValues($fields, $values);
        }
    }
public function setValues(array $values = null, bool $force = false)
    {
        if ($values == null) {
            return;
        }
        $fields = $this->getFields();
        if (method_exists($this, 'beforeSetValues')) {
            $this->beforeSetValues($fields, $values);
        }
        if (isset($values['id'])) {
            $this->id = intval($values['id']);
        }
        foreach ($fields as $name => $field) {
            if ($field->close) {
                continue;
            }
            if (!$force && $field->value !== null) {
                continue;
            }
            $box = Field::getInstance($field->type);
            if ($box != null) {
                $box->init($field, $values);
            } else {
                $field->value = isset($values[$name]) ? $values[$name] : null;
            }
        }
        if (method_exists($this, 'afterSetValues')) {
            $this->afterSetValues($fields, $values);
        }
    }
设置表单值
@param array|null $values
@param bool $force
@throws \Exception