输出代码重复利用

浏览:901 发布日期:2016/01/01 分类:求助交流 关键字: 重复利用
这个文件叫做Yq.class.php,是在Thinkphp/Library/Think目录下的!听别人说,我所有的需要重复输出的代码都放在这里,我就不用每个控制器里面都写一个输出代码了。

但是我弄了半天仍然没有成功,请大神告诉我应该怎么做,求求大神了!!

求求求了,我是真的搞不懂啊,我总是出错,下面的是我写的Yq.class.php代码<?php 
namespace Think;
use Think\Controller;


class Yq extends Controller {

   $sessn=session('name');
    if (!empty($sessn)) {
                $zhongxin='<li class="zhongxin"><a href="http://www.9ido.cn/index.php/Index/zhongxin">个人中心</a> </li>';
                $quit='<li><a href="http://www.9ido.cn/index.php/Index/quit">退出</a> </li>';
            $this->assign('quit',$quit);    
            $this->assign('zhongxin',$zhongxin);

    }else{

        $zhuce='<li class="zhuce"><a href="http://www.9ido.cn/index.php/Index/zhuce">注册 </a> </li>';
        $login='<li class="login"><a href="http://www.9ido.cn/index.php/Index/login">登陆 </a> </li>';
        $this->assign('zhuce',$zhuce);
        $this->assign('login',$login);
            
    }







}

 ?>
我是真的不知道这个文件要怎么弄啊!!
最佳答案
评论() 相关
后面还有条评论,点击查看>>