Php Zend#u form:what';他补充说;enctype“;对于
Zend将enctype添加到所有表单中。那有什么用?我怎样才能移除它Php Zend#u form:what';他补充说;enctype“;对于,php,zend-framework,zend-form,Php,Zend Framework,Zend Form,Zend将enctype添加到所有表单中。那有什么用?我怎样才能移除它 <form action="" method="post" enctype="application/x-www-form-urlencoded" id="myform"> </form> 如果不修补Zend_表单类或从其派生并重写getEnctype() 查看getEnctype()方法。enctype=“application/x-www-form-
<form action=""
method="post"
enctype="application/x-www-form-urlencoded"
id="myform">
</form>
如果不修补Zend_表单类或从其派生并重写
getEnctype()
查看
getEnctype()
方法。enctype=“application/x-www-form-urlencoded”
是POST方法的形式要求 如果要删除它,必须覆盖Zend_Form_Decorator_Form的getOptions方法并删除以下两行:
class Zend_Form_Decorator_Form extends Zend_Form_Decorator_Abstract
{
[..]
public function getOptions()
{
if (null !== ($element = $this->getElement())) {
if ($element instanceof Zend_Form) {
[..]
// To remove
if ($method == Zend_Form::METHOD_POST) {
$this->setOption('enctype', 'application/x-www-form-urlencoded');
}
[..]
它是一个atribute,用于标识您试图向服务器发布的表单类型。在这种情况下,表示您发送文本信息。如果您想发送文件,例如更复杂的文件,则应使用enctype的“多部分/表格数据”值。有关更多信息,请参阅。,了解什么?那里的
enctype
没有问题。哪里指定了enctype
是必需的参数?这是POST表单的默认值。您无需指定,但浏览器仍会将其发送到服务器。如前所述,这是默认设置。在文件上载的情况下,您必须将多部分/表单数据指定为enctype。对于上载表单:$form->setMethod('post')->setEnctype(Zend_form::enctype_multipart);