使用方法:
function table($table, $field, $id)
{
global $dsql;
$primarys = array();
$table = strpos($table, '#@_') === false?(strpos($table, 'dede_') === false?'cn_'.$table:str_replace('dede_','cn_',$table)):$table;
$dsql -> Execute("me","SHOW COLUMNS FROM `$table`");
while ($r = $dsql->GetArray())
{
if($r['Key'] == 'PRI') $primarys[] = $r['Field'];
}
if(!emptyempty($primarys))
{
$primary = $primarys[0];
$result = $dsql -> GetOne("SELECT `$field` FROM `$table` WHERE `$primary`= $id");
}
return isset($result[$field])?$result[$field]:'';
}
本文织梦DEDECMS搜索结果调用自定义字段到此结束。因为某人不如你所愿爱你,并不意味着你不被别人所爱。小编再次感谢大家对我们的支持!