yocto / yoclib-propertylist
此yoc库使您的项目能够使用PHP编码和解码属性列表文件。
v1.0.0
2023-05-27 14:07 UTC
Requires
- php: ^7||^8
- ext-ctype: *
- ext-simplexml: *
Requires (Dev)
- phpunit/phpunit: ^7||^8||^9
This package is auto-updated.
Last update: 2024-08-27 16:45:11 UTC
README
此yoc库使您的项目能够使用PHP编码和解码属性列表文件。
状态
安装
composer require yocto/yoclib-propertylist
使用
序列化
use YOCLIB\PropertyList\PropertyList; $object = ['string_data',true,false]; $plist = new PropertyList; $plist->setObject($object); $xml = $plist->serialize(PropertyList::FORMAT_XML);
反序列化
use YOCLIB\PropertyList\PropertyList; $xml = '<plist xlmns="https://www.apple.com/DTDs/PropertyList-1.0.dtd" version="1.0"><array><string>string_data</string><true/><false/></array></plist>'; $plist = new PropertyList; $plist->deserialize(PropertyList::FORMAT_XML,$xml); $object = $plist->getObject();
支持的格式
属性列表有以下格式之一:
注意:目前,该库中ASCII格式的实现不应被信任。它不理解注释,并且硬编码了一些空白字符检测,因此可能无法处理有效的ASCII属性列表。