Form Builder PHP Class - 生成 HTML 表单PHP类
jopen
12年前
PFBC 是一个面向对象的 PHP 类用来构建 HTML 表单,包含 Ajax 请求、jQuery、验证码、可视化编辑器等特性,集成了 Bootstrap。
其目的是:
- 通过一个面向对象PHP结构促进表单的快速开发
- Eliminate the grunt/repetitive work of writing the html and validation when building forms.
- 通过使用一个一致/测试的工具,减少人为错误。
示例代码:
<?php //PFBC 2.x PHP 5 >= 5.3 session_start(); include($_SERVER["DOCUMENT_ROOT"] . "/PFBC/Form.php"); $form = new PFBC\Form("GettingStarted"); $form->addElement(new PFBC\Element\Textbox("My Textbox:", "MyTextbox")); $form->addElement(new PFBC\Element\Select("My Select:", "MySelect", array( "Option #1", "Option #2", "Option #3" ))); $form->addElement(new PFBC\Element\Button); $form->render(); //PFBC 2.x PHP 5 session_start(); include($_SERVER["DOCUMENT_ROOT"] . "/PFBC/Form.php"); $form = new Form("GettingStarted"); $form->addElement(new Element_Textbox("My Textbox:", "MyTextbox")); $form->addElement(new Element_Select("My Select:", "MySelect", array( "Option #1", "Option #2", "Option #3" ))); $form->addElement(new Element_Button); $form->render(); ?>