简体   繁体   English

PHP-将JSON转换为Plist?

[英]PHP - Convert JSON to Plist?

一个人如何使用PHP(以及任何必要的库)将JSON数据转换为Plist数据?

I would decode the data and then encode it using CFPropertyList 我将解码数据,然后使用CFPropertyList对其进行编码

Simply: 只是:

$plist = new CFPropertyList();    
$td = new CFTypeDetector();  
$guessedStructure = $td->toCFType( json_decode($json) );
$plist->add( $guessedStructure );
$xml = $plist->toXML();

Transfer it into an array first. 首先将其传输到数组中。 After that, do whatever you want with that 之后,随便做什么

json_decode($json);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM