PHP code example of smk / smk_excel

1. Go to this page and download the library: Download smk/smk_excel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

smk / smk_excel example snippets

 bash
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider";
php artisan excel:init
 bash
 $p = array();
        $p[] = array(
            'name' => 'name',//字段名称
            'type' => array( //字段需要的验证,目前只有 string,int,需要的可以加
                'string'
            ),
            'self_verify' => '',//如果需要自己验证,此处就填写你自己验证的地址,你会收到一个id和一个值来验证
            'can_be_null' => false,//这个字段是否能为空
            'chinese' => "姓名", //字段显示的中文名
            'preg_err_msg' => '正则表达式验证不通过',//如果验证不通过显示的中文
            'preg' => '',//可以支持正则表达式,如果为空则不填写
            'id' => 1 //数组中唯一的ID,这个ID是你自己分配的,必须要是唯一
        );
 return response()->json($p);//最后把这个json返回出来