PHP code example of taoser / think-setarr
1. Go to this page and download the library: Download taoser/think-setarr 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/ */
taoser / think-setarr example snippets
composer
$add = [
1,true,false,
"//支持备注的添加",
"base_path() . DIRECTORY_SEPARATOR . 'public',"
'a' => 1,
'b' => 'b',
'c' => true,
'd' => false,
'e' => "support\bootstrap\Session::class,",
"// 这里这一行添加备注是无效的,在子数组前写备注位置会不正确",
'f' => [
22,true,false,
'aa' => 11,
'bb' => 'bb',
'cc' => true,
'dd' => false,
"//支持备注的添加",
'ee' => "base_path() . DIRECTORY_SEPARATOR . 'public',"
'ff' => [
333,true,false,
'aaa' => 11,
'bbb' => 'bb',
'ccc' => true,
'ddd' => false,
'eee' => "support\bootstrap\Session::class,",
'fff' => [
"//支持备注的添加,最后一级数组只能是一维数组",
'aaaa' => 11,
'bbbb' => 'bb',
'cccc' => true,
'dddd' => false,
'eeee' => "support\bootstrap\Session::class,",
],
],
'gg' => [
1,true,false,
"base_path() . DIRECTORY_SEPARATOR . 'public',"
'aa' => 11,
'bb' => 'bb',
'cc' => true,
'dd' => false,
'ee' => "support\bootstrap\Session::class,",
],
],
'g' => [
1,true,false,
'ga' => 11,
'gb' => 'bb',
'gc' => true,
'gd' => false,
'ge' => "support\bootstrap\Session::class,",
'gf' => [
1,true,false,
"base_path() . DIRECTORY_SEPARATOR . 'public',"
'gaa' => 11,
'gbb' => 'bb',
'gcc' => true,
'gdd' => false,
'gee' => "support\bootstrap\Session::class,",
],
],
];
$conf = \taoser\SetArr::name('app')->add($data);
use taoser\SetArr;
$edit = [
'a' => 1,
'b' => 'b',
'c' => true,
'd' => false,
'e' => "support\bootstrap\Session::class,",
'f' => [
'aa' => 11,
'bb' => 'bb',
'cc' => true,
'dd' => false,
'ee' => "base_path() . DIRECTORY_SEPARATOR . 'public',"
'ff' => [
'aaa' => 11,
'bbb' => 'bb',
'ccc' => true,
'ddd' => false,
'eee' => "support\bootstrap\Session::class,",
'fff' => [
'aaaa' => 11,
'bbbb' => 'bb',
'cccc' => true,
'dddd' => false,
'eeee' => "support\bootstrap\Session::class,",
],
],
'gg' => [
1,true,false,
"base_path() . DIRECTORY_SEPARATOR . 'public',"
'aa' => 11,
'bb' => 'bb',
'cc' => true,
'dd' => false,
'ee' => "support\bootstrap\Session::class,",
],
],
'g' => [
'ga' => 11,
'gb' => 'bb',
'ge' => "support\bootstrap\Session::class,",
'gf' => [
'gaa' => 11,
'gbb' => 'bb',
'gcc' => true,
'gdd' => false,
'gee' => "support\bootstrap\Session::class,",
],
],
];
$conf = SetArr::name('app')->edit($edit);
use taoser\SetArr;
$del = [
true,false,111,'US-A',
"// 删除备注",
"base_path() . DIRECTORY_SEPARATOR . 'public',",
'a' => 0,
'b' => 0,
'c' => 0,
'd' => 0,
'e' => 0,
'f' => [
'aa' => '',
'bb' => '',
'cc' => '',
'dd' => '',
'ee' => ""
'ff' => [
'aaa' => false,
'bbb' => false,
'ccc' => false,
'ddd' => false,
'eee' => false,
'fff' => [
'aaaa' => null,
'bbbb' => null,
'cccc' => null,
'dddd' => null,
'eeee' => null,
],
],
];
$conf = SetArr::name('app')->delete($del);
html
use taoser\SetArr;
$data = [
true,false,111,
'aaa'=>'bbb',
'ccc'=>[
true,
222,
"app()";
"//备注信息",
......
],
......
];
$result = SetArr::name('app')->add($data);