选择语言 :

 Core_Form::label

Creates a form label. Label text is not automatically translated.

echo Form::label('username', 'Username');
string Core_Form::label( string $input [, string $text = null , array $attributes = null ] )
uses
HTML::attributes

参数列表

参数 类型 描述 默认值
$input string Target input
$text string Label text null
$attributes array Html attributes null
返回值
  • string
File: ./core/classes/form.class.php
public static function label($input, $text = null, array $attributes = null)
{
    if ($text === null)
    {
        // Use the input name as the text
        $text = ucwords(preg_replace('/\W+/', ' ', $input));
    }

    // Set the label target
    $attributes['for'] = $input;

    return '<label' . HTML::attributes($attributes) . '>' . $text . '</label>';
}