HTML 输入数组 [英] HTML input arrays

查看:31
本文介绍了HTML 输入数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<input name="foo[]" ... >

我以前用过这些,但我想知道它叫什么,是否有规范?

I've used these before, but I'm wondering what it is called and if there is a specification for it?

我在 HTML 4.01 Spec 和结果在各种 Google 结果中仅将其称为数组"以及许多处理表单数据的 PHP 示例.

I couldn't find it in the HTML 4.01 Spec and results in various Google results only call it an "array" along with many PHP examples of processing the form data.

推荐答案

评论中有一些参考和指点在 PHP.net 的这个页面上:

There are some references and pointers in the comments on this page at PHP.net:

托斯滕说

XHTML 规范的 C.8 部分兼容性指南适用于使用 name 属性作为片段标识符.如果您检查 DTD,您会发现 'name' 属性仍然定义为表单元素的 CDATA."

"Section C.8 of the XHTML spec's compatability guidelines apply to the use of the name attribute as a fragment identifier. If you check the DTD you'll find that the 'name' attribute is still defined as CDATA for form elements."

Jetboy 说

"根据这个:http://www.w3.org/TR/xhtml1/#C_8 XHTML 1.0 中 name 属性的类型已更改,这意味着 XHTML 的 name 属性中的方括号无效.

"according to this: http://www.w3.org/TR/xhtml1/#C_8 the type of the name attribute has been changed in XHTML 1.0, meaning that square brackets in XHTML's name attribute are not valid.

无论如何,在撰写本文时,W3C 的验证器并未在 XHTML 文档中发现这一点."

Regardless, at the time of writing, the W3C's validator doesn't pick this up on a XHTML document."

这篇关于HTML 输入数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆