?
Dokumen ini menggunakan Manual laman web PHP Cina Lepaskan
Attribute Name | Type | Required | Default | Description |
---|---|---|---|---|
values | array | Yes, unless using options attribute | n/a | an array of values for dropdown |
output | array | Yes, unless using options attribute | n/a | an array of output for dropdown |
selected | string/array | No | empty | the selected option element(s) |
options | associative array | Yes, unless using values and output | n/a | an associative array of values and output |
name | string | No | empty | name of select group |
屬性 | 類型 | 是否必須 | 缺省值 | 描述 |
---|---|---|---|---|
values | array | Yes, unless using options attribute | n/a | 包含下拉列表各元素值的數(shù)組 |
output | array | Yes, unless using options attribute | n/a | 包含下拉列表各元素顯示值的數(shù)組 |
selected | string/array | No | empty | 已選定的元素或元素數(shù)組 |
options | associative array | Yes, unless using values and output | n/a | 包含值和顯示的關(guān)聯(lián)數(shù)組 |
name | string | No | empty | 下拉菜單的名稱 |
html_options is a custom function that creates html option group with provided data. It takes care of which item(s) are selected by default as well. Required attributes are values and output, unless you use options instead.
自定義函數(shù) html_options 根據(jù)給定的數(shù)據(jù)創(chuàng)建選項組. 該函數(shù)可以指定哪些元素被選定. 要么必須指定 values 和 ouput 屬性,要么指定 options 替代.
If a given value is an array, it will treat it as an html OPTGROUP, and display the groups. Recursion is supported with OPTGROUP. All output is XHTML compatible.
如果給定值是數(shù)組,將作為 OPTGROUP 處理,且支持遞歸. 所有的輸出與 XHTML 兼容.
If the optional name attribute is given, the <select name="groupname"></select> tags will enclose the option list. Otherwise only the option list is generated.
如果指定了可選屬性 name,該選項列表將將被置于<select name="groupname"></select>標簽對中. 如果沒有指定,那么只產(chǎn)生選項列表.
All parameters that are not in the list above are printed as name/value-pairs inside the <select>-tag. They are ignored if the optional name is not given.
上表未提到的其它參數(shù)在 <select> 標簽中以"名稱/屬性"對的方式顯示. 如果沒有指定可選屬性 name 這些參數(shù)將被忽略.
Example 8-8. html_options
|