利用简单的SQL语句调用当天最新内容来进行展示,比如用在最新内容中供蜘蛛爬取。

$timedays=strtotime(date("Y-m-d",time()));
$timedaye=$timedays+3600*24;
$r=$empire->query('select id,title,titleurl from '.$dbtbpre.'ecms_news where newstime>='.$timedays.' and newstime<='.$timedaye.' order by newstime desc limit 10');
while($row=$empire->fetch($r)){
?>



  • 复制直接可以,这个是调用的新闻模型的数据表,如果是其它表稍改一下立即可以用。


    标签:最新内容 sql调用 帝国cms