Download the PHP package wekyun/check without Composer

On this page you can find all versions of the php package wekyun/check. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package check

thinkphp-check使用

参数接收验证插件,依赖TP框架的场景验证.

插件只能是TP5.0以及TP5.1可以使用,TP6还未尝试测试使用

1:安装插件:

2:创建基础验证类

TP5.0请在框架的 application/common/ 目录下创建创建一个文件夹 validate ,然后创建文件 Common.php 即可。

TP5.1创建验证类文件的命令行,直接在项目根目录打开终端运行即可

如果创建的位置是 application\common\validate\Common.php ,文件内容请可以直接复制粘贴成如下:

<?php

namespace app\common\validate;

use think\Validate;

class Common extends Validate
{
    /*
     *  验证的字段,插件接受的字段如果与$rule的键相同的,就会验证其定义的规则,
     *
     *  例如:$param = Check::check('com', ['cs_email.']);
     *  就会先验证 cs_email 字段是否传参,如果没有传就会调用配置文件check.php 的 err_func的这个方法提示
     *  如果字段传递了,就会验证框架的内置规则,假设cs_email = 123 ,就会提示: {"msg":"cs_email格式不符","code":203}  提示的格式和字段,可以修改err_func的这个方法
     *
     *  更多的验真规则,请查阅框架内置规则: 验证也支持正则哦
     *  TP5.1: https://static.kancloud.cn/manual/thinkphp5_1/354107
     *  TP5.0: https://static.kancloud.cn/manual/thinkphp5/129356
    * */
    protected $rule = [
        'cs_name' => 'max:25',
        'cs_age' => 'number|between:1,120',
        'cs_email' => 'email',
    ];

    protected $message = [

    ];

    protected $scene = [
    ];

}

3:创建配置文件

TP5.0请在application/extra/ 目录下创建配置文件 check.php 。

TP5.1请在根目录的 config 目录下,创建配置文件:check.php

文件内容如下:err_func 是验证参数错误的处理方法。可以自行修改

4:代码中使用

1:使用插件接受接收参数,要使用的字段,就必须要接收定义,如果不接收就直接使用,会提示不存在,务必谨记!

2:接受的参数会返回一个数组,$param 就是所有接受的参数

//参数的接收
$param = Check::check('com', 'id,name,sex,mobile');             //字符串形式
$param = Check::check('com', ['id','name','sex','mobile']);     //数组形式,推荐此形式

$param = Check::check('com', 'id.');//字段id为必传   .表示必传
$param = Check::check('com', 'sex:0');//接收sex字段,如果不传默认值为0

$param = Check::check('com', 'mobile.');//mobile为必传   .表示必传
$param = Check::check('com', 'mobile|手机号.');//手机号必传   .表示必传 |表示自定义的提示名称

$param = Check::check('com', 'mobile.>请输入手机号码');//字段mobile为必传   .表示必传 >表示不传递参数的提示信息

//字段mobile为必传  .表示必传 >表示不传递参数的提示信息 |表示自定义的提示名称,并且如果手机号码格式不正确会提示手机号码格式不正确,如果不定义则提示mobile格式不正确
$param = Check::check('com', 'mobile|手机号码.>请输入手机号码');//不传会提示请输入手机号码,传错了会提示 手机号码格式错误

5指定参数不验证规则

//mobile字段前面增加了英文的感叹号:! ,所以手机号这个字段不会验证是否正确,有些时候手机号不是必填的,可能会给0,就不会验证非法
$param = Check::check('com', ['name|名称.','sex.>请选择性别','!mobile|手机号']);

6:手册


All versions of check with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wekyun/check contains the following files

Loading the files please wait ...