jarzon/form 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jarzon/form

Composer 安装命令:

composer create-project jarzon/form

包简介

Form generator/validator

README 文档

README

Install

composer require jarzon/form

Usage

Build the form

<?php
$form = new Jarzon\Form($_POST);

// Create your form
$form
  ->text('name')
  ->min(2)
  ->max(100)
  ->required()
  ->placeholder('Joe Doe')

  ->number('age')
  ->min(0)
  ->max(100)
  
  ->submit();

Show the form in the view

<?=$form('form')->html?>

    <div><?=$form('name')->label('Name:')->row?></div>
    
    <div><?=$form('age')->label('Age:')->row?></div>
    
    <?=$form('submit')->value('Save')->html?>

<?=$form('/form')->html?>

Process the form values

<?php
// On submit validate the form values
if($form->submitted()) {
    try {
        // Does the validation based on the inputs types, min/max, required
        if($values = $form->validation()) {
            // Do what you want with the returned values
            echo "Your name is {$values['name']}";
        }
    }
    catch (\Jarzon\Form\ValidationException $e) {
        // ->validation() throw a custom Exception if there is an invalid value
        echo "Error: {$e->getMessage()}";
    }
}

统计信息

  • 总下载量: 465
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-05-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固