按序列类型:
<?php
header('Content-type:application/json;charset=utf-8');
// 索引数组
$i= array("hexingxing","24","male",["music","UX/UE","game"],"hexingxing.cn","it@hexingxing.cn");
echo json_encode($i, JSON_FORCE_OBJECT);
?>
打印结果:
{"0":"hexingxing","1":"24","2":"male","3":{"0":"music","1":"UX\/UE","2":"game"},"4":"hexingxing.cn","5":"it@hexingxing.cn"}
调用数据:
{略}
指定 ID 类型:
<?php
header('Content-type:application/json;charset=utf-8');
// 索引数组
$i= array('nane'=>'hexingxing','age'=>'24','gender'=>'male','like'=>['music','UX/UE','game'],'web'=>'hexingxing.cn','email'=>'it@hexingxing.cn');
echo json_encode($i, JSON_FORCE_OBJECT);
?>
打印结果:
{"nane":"hexingxing","age":"24","gender":"male","like":{"0":"music","1":"UX\/UE","2":"game"},"web":"hexingxing.cn","email":"it@hexingxing.cn"}
调用数据:
{略}
友情提示:本站所有文章,如无特殊说明或标注,均为何星星原创发布。与此同时,趋于近年来本站的文章内容频繁被他站盗用与机器采集,现已全局禁用网站文字内容操作,了解详情或转载文章请 点此 继续!
0 条评论