我想将在 Joomla 文章中创建的一些信息放入独立于 Joomla 的单独系统中。这是我从 MySQL 查询中获取的字段返回的示例值(该列是“com_content”表中的“images”):
{"image_intro":"images\/Capitol_-_D_C__-_Daytime.jpg","float_intro":"right","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
现在在 PHP 中,我想将这个傻瓜转换成一个数组。有什么想法吗?
最佳答案
PHP 中的
json_decode()
将是您的 friend ,请参阅文档:
http://docs.php.net/manual/de/function.json-decode.php
像这样:
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));
关于php - 将 Joomla 值从数据库转换为 PHP 数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24151727/