【文件属性】:
文件名称:common-helpers
文件大小:5KB
文件格式:ZIP
更新时间:2021-04-11 03:43:19
PHP
#普通帮手
类,可帮助您编写稳定的代码
演示版
1.任务:从数组中获取值并检查现有值,替换默认值
use Helpers \ CommonHelpers as ch;
$ dict = [
'order_id' => '122' ,
'delivery_id' => '1'
];
$ orderId = ( int ) ch:: getArrayValue ( 'order_id' , $ dict , 0 );
2.任务:从数组获取第一个值,并检查它是否不是空字符串
例如,如果您处理请求并想处理get / post参数。 可以从具有许多值的某个过滤器接收它,例如无线电组或类似的东西。 并且您想要获得许多价值中的第一价值。
use Helpers \ CommonHelpers as ch;
use Filters \ ColorHandler as ColorFilte
【文件预览】:
common-helpers-main
----src()
--------CommonFactory.php(852B)
--------CommonHelpers.php(3KB)
----CONTRIBUTING.md(0B)
----LICENSE(1KB)
----README.md(1KB)
----tests()
--------test.php(481B)
----.gitignore(15B)
----composer.json(453B)