php 用于excel的PHP数组到JSON字符串
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 用于excel的PHP数组到JSON字符串相关的知识,希望对你有一定的参考价值。
[
{
"response": "",
"question": "How did you rate the quality of the services offered to you?",
},
{
"response": "",
"question": "How would you rate the accessibility of information?",
},
{
"response": "",
"question": "How helpful were our representatives in their assistance?",
},
{
"response": "",
"question": "How responsive were our representatives?",
},
{
"response": "",
"question": "How easy was it for you to reach our representatives?",
},
{
"response": "",
"question": "How competent were our representatives?",
},
{
"response": "",
"question": "How would you rate the professionalism displayed by our representatives in their handling of enquiries and complaints?",
},
{
"response": "",
"question": "Overall were you satisfied with the services that we offered?",
},
{
"response": "",
"question": "If your respond is below 3 for Question 8, please explain why?",
},
{
"response": "",
"question": "How did you hear about MSC Malaysia Status?",
},
{
"response": "",
"question": "How do you think the services offered to you can be further improve?",
},
{
"response": "",
"question": "Any other comments or suggestions?",
},
]
$data_company_csi = $profile["data_company_csi"];
if (isset($data_company_csi) && is_array($data_company_csi)) {
$csi_result = '[
';
foreach ($data_company_csi as $row) {
$csi_result = $csi_result. '
{
';
foreach($row as $key => $val)
{
if ($key === 'question' || $key === 'response' ) {
$csi_result = $csi_result. '"'.$key.'": "'.$val.'",
';
}
}
$csi_result = rtrim($csi_result, ',');
$csi_result = $csi_result. '
},
';
}
$csi_result = $csi_result. '
]
';
}
以上是关于php 用于excel的PHP数组到JSON字符串的主要内容,如果未能解决你的问题,请参考以下文章