DEDECMS标签中嵌入执行sql语句的方法详解,掌握了这个方法,想在dedecms模板中调用任何数据都没问题,实例代码如下所示:
复制代码 代码如下:
{dede:field.id runphp='yes'}
$tsql = new DedeSql(false);
$tsql->SetQuery("select * from dede_archives where id=@me");
$tags = "";
$tsql->Execute('t');
while($row = $tsql->GetArray('t',MYSQL_ASSOC)){
$tags .= $row['title'];
}
@me = $tags;
{/dede:field.id}
$tsql = new DedeSql(false);
$tsql->SetQuery("select * from dede_archives where id=@me");
$tags = "";
$tsql->Execute('t');
while($row = $tsql->GetArray('t',MYSQL_ASSOC)){
$tags .= $row['title'];
}
@me = $tags;
{/dede:field.id}
本文地址:http://www.45fan.com/bcdm/9995.html