tacoberu/php-naiacode

使用元数据进行文本的序列化和反序列化,以及从/到可读文本字符串的转换。

v1.0.2 2021-02-19 00:49 UTC

This package is auto-updated.

Last update: 2024-09-19 09:14:47 UTC


README

使用元数据进行文本的序列化和反序列化,以及从/到可读文本字符串的转换。

$str =
"Any-Header: with value
Meta: {"vendor":"zim","ver":"0.4"}
Content-Type: text/x-zim-wiki


And Lorem ipsum doler ist.";

(new Decoder())->decode($str) == [
    "And Lorem ipsum doler ist.",
    [
        'any-header' => "with value",
        'meta' => (object) [
            'vendor' => 'zim',
            'ver' => '0.4',
        ],
        'content-type' => "text/x-zim-wiki",
    ]
]

以及类似的编码。