萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> php數組的靈活應用

php數組的靈活應用

php數組的靈活應用

function addInput($a)
{
    if(is_array($a))
    {
        $title        = $a['title'];
        $name        = $a['name'];
        $value        = $a['value'] ? $a['value'] : "";
        $type        = $a['type'] ? $a['type'] : "text";
        $maxlength    = $a['maxlength'] ? $a['maxlength'] : "255";
        $readonly    = $a['readonly'] ? $a['readonly'] : "";
        $required    = $a['required'] ? $a['required'] : "false";
        $check        = $a['check'];
        $id        = $a['id'];
        $width        = $a['width'];
        $tip        = $a['tip'];
    }
    $title,$name,$value="",$type="text",$maxlength="255",$readonly,$required="false",$check,$id,$width,$tip
    $this->form .= "<li>\n";
    $this->form .= "<label>".$title.":</label>\n";
    $this->form .= "<input name=\"".$name."\" value=\"".$value."\" type=\"".$type."\" maxlength=\"".$maxlength."\" required=\"".$required."\" check=\"".$check."\" id=\"".$id."\" class=\"input\" ".$readonly." style=\"width:".$width."px;\" showName=\"".$title."\" /> ";
    $this->form .= "<span class=\"tip\">".$tip."</span>\n";
    $this->form .= "</li>\n";
}

copyright © 萬盛學電腦網 all rights reserved