include/taglib/json.lib.php
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
if(!defined('DEDEINC'))
{
exit("Request Error!");
}
require_once(dirname(__file__).'/../json.class.php');
/*>>dede>>
<name>JSON数据调用类</name>
<type>全局标记</type>
<for>V57</for>
<description>调用某个远程连接的json数据库</description>
<demo>
{dede:json url='http://yoursite/json.php' cache=300}
[field:id/]-[field:title/]<br/>
{/dede:json}
</demo>
<attributes>
<iterm>url:json数据地址</iterm>
<iterm>cache:缓冲时间</iterm>
</attributes>
>>dede>>*/
function lib_json(&$ctag,&$refObj)
{
global $dsql,$sqlCt,$cfg_soft_lang;
$attlist="url|";
FillAttsDefault($ctag->CAttribute->Items,$attlist);
extract($ctag->CAttribute->Items, EXTR_SKIP);
$Innertext = trim($ctag->GetInnerText());
if($url=='' || $Innertext=='') return '';
$ctp = new DedeTagParse();
$ctp->SetNameSpace('field','[',']');
$ctp->LoadSource($Innertext);
$mcache = new MiniCache;
$GLOBALS['autoindex'] = 0;
$chash = md5($url);
if(!$row = $mcache->Get($chash))
{
$content = @file_get_contents($url);
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$row = $json->decode($content);
if($cfg_soft_lang != 'utf-8')
{
$row = AutoCharset($row, 'utf-8', 'gb2312');
}
$mcache->Save($chash, $row, $cache);
}
$revalue = "";
foreach($row as $key => $value)
后面还有 140 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
