dede如何新建一个ajax服务端输出文件
<?php
require_once(dirname(__FILE__)."/include/common.inc.php");
AjaxHead();
$dsql->SetQuery("Select id as ID From `dede_arctype` where reid=".$reid);
$dsql->Execute();
$channels = Array();
while($row = $dsql->GetArray())
{
$channels[] = $row['ID'];
}
//echo json_encode($channels);
foreach ($channels as $key=>$value)
{
$data[]=$value;
}
echo json_encode($data);
?>
这样就可以返回 json 数据给前端了,非常简单,只要是使用了 json_encode($xxx) 返回json格式化的数据!~