最新消息: 新版网站上线了!!!

dede json的使用方法(dede数据json)

dede json即跨域的解决方法

$cfg_NotPrintHead = false;  

header("Content-Type: text/html; charset=utf-8");  

include_once (dirname(__FILE__)."/include/common.inc.php");  

error_reporting(E_ALL || ~E_NOTICE);  

require_once(DEDEINC.'/json.class.php');  

$reval = array();  

$dsql->SetQuery("Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault, 

tp.defaultname,tp.namerule,tp.moresite,tp.siteurl,tp.sitepath 

from #@__archives arc left join #@__arctype tp on arc.typeid=tp.id  order by arc.pubdate desc limit 0,10");  

$dsql->Execute('me');  

while ($row = $dsql->GetArray('me')) {  

/* $row['title'] = gb2utf8($row['title']);  

$row['sitepath']=gb2utf8($row['sitepath']);

$row['typedir'] =gb2utf8( str_replace('{cmspath}','',$row['typedir']));

$row['aid'] =gb2utf8( $row['id']); */

$row['title'] = $row['title'];

$row['sitepath']=$row['sitepath'];

$row['typedir'] =str_replace('{cmspath}','',$row['typedir']);

$row['aid'] = $row['id']; 

$reval[] = $row;  

}  

$json = new Services_JSON(SERVICES_JSON_SUPPRESS_ERRORS);  

$arr = $json->encode($reval);  

echo $_GET['callback']."(".json_encode($arr).");";

?> 


转载请注明:谷谷点程序 » dede json的使用方法(dede数据json)