djeux / array-export
将数组导出为格式化的字符串,安全地保存为文件
dev-master
2020-06-19 17:35 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7.0
- symplify/easy-coding-standard: ^6.1
This package is auto-updated.
Last update: 2024-08-30 01:32:12 UTC
README
将数组导出为字符串,可以稍后保存为具有适当格式的文件。
作为 var_export
的替代品,支持定义自定义缩进大小和字符。
使用方法
<?php use Djeux\ArrayExport\Export; $array = [ 'one' => 'String', 'two' => 'String', ]; $asString = Export::make()->export($array); /** [ 'one' => 'String', 'two' => 'String', ] */ $asFile = Export::make()->asFile($array); /** <?php return [ 'one' => 'String', 'two' => 'String', ]; */