core/Form.php
public function fieldCode($name, $type = null, array $attr = null)
    {
        if ($name === null) {
            throw new \Exception('必须指定名称，或者字段');
        }
        if ($attr === null && is_array($type)) {
            $attr = $type;
            $type = null;
        }
        if (is_string($name)) {
            $field = $this->getField($name);
        } elseif ($name instanceof Field) {
            $field = $name;
        } else {
            throw new \Exception('错误的参数');
        }
        if ($attr === null && !is_array($attr)) {
            $attr = [];
        }
        if ($field == null) {
            $field = new Field($this);
            if (is_string($name)) {
                $field->name = $name;
                $field->boxName = $name;
                $field->boxId = $name;
            }
        }
        if ($type !== null) {
            $field->type = $type;
        }
        return $field->code($attr);
    }
public function fieldCode($name, $type = null, array $attr = null)
    {
        if ($name === null) {
            throw new \Exception('必须指定名称，或者字段');
        }
        if ($attr === null && is_array($type)) {
            $attr = $type;
            $type = null;
        }
        if (is_string($name)) {
            $field = $this->getField($name);
        } elseif ($name instanceof Field) {
            $field = $name;
        } else {
            throw new \Exception('错误的参数');
        }
        if ($attr === null && !is_array($attr)) {
            $attr = [];
        }
        if ($field == null) {
            $field = new Field($this);
            if (is_string($name)) {
                $field->name = $name;
                $field->boxName = $name;
                $field->boxId = $name;
            }
        }
        if ($type !== null) {
            $field->type = $type;
        }
        return $field->code($attr);
    }
获取一个输入框
@param $name
@param null $type
@param array|null $attr
@return mixed|string|void
@throws \Exception