//上一篇 $front=$Article->where("id<".$id)->order(&#39;id desc&#39;)->limit(&#39;1&#39;)->find(); $this->assign(&#39;front&#39;,$front); //下一篇 $after=$Article->where("id>".$id)->order(&#39;id desc&#39;)->limit(&#39;1&#39;)->find(); $this->assign(&#39;after&#39;,$after); //上一篇 $front=$Classroom->where("nid<".$nid)->order(&#39;nid desc&#39;)->limit(&#39;1&#39;)->find(); $f=!$front?&#39;没有了&#39;:&#39;.__URL__.&#39;/nid/&#39;.$front[&#39;nid&#39;].&#39;">&#39;.$front[&#39;title&#39;].&#39;&#39;; $this->assign(&#39;front&#39;,$f); //下一篇 $after=$Classroom->where("nid>".$nid)->order(&#39;nid desc&#39;)->limit(&#39;1&#39;)->find(); $a=!$after?&#39;没有了&#39;:&#39;.__URL__.&#39;/nid/&#39;.$after[&#39;nid&#39;].&#39;">&#39;.$after[&#39;title&#39;].&#39;&#39;; $this->assign(&#39;after&#39;,$a);