html用think.session.显示,怎么在控制器里面设置变量啊?TP框架我是初学者

WBOY
Release: 2016-06-20 12:40:03
Original
628 people have browsed it

<?phpnamespace Home\Controller;use Think\Controller;class LoginController extends Controller{    public function index()    {        $this->display('index/login');    }    public function logincl()    {         if (IS_POST) {                                $user = M('member')->where(array('MB_username' => admin))->find();   //在HTML里我用{$Think.session.adminuser},代码可以显示我当前登录的账号,但是我用下面{$Think.session.test},就显示不了,空白的,                $test = M('aconfig')->where(array('zcinfo' ))->find();      //我的HTML用{$Think.session.test}代码这个显示不了,test变量的值,那里出错了吗,(aconfig 这个是数据库表名)                   session('test',$test['zcinfo']);             //我的HTML用{$Think.session.test}代码这个显示不了,test变量的值,那里出错了吗,  (aconfig 这个是数据库表的字段名,我就是想在html显示这个字段里面值),求救                    session('adminuser', $user['mb_username']);                                                               $_SESSION['logintime'] = time();                    die("<script>document.location.href='/admin.php/Home/Index/main';</script>");        }    }        }
Copy after login


回复讨论(解决方案)

我在html是用{$Think.session.test}代码显示

另外 我在html用 为什么不行呢

            <td bordercolor="cccccc"><select name="opwww" id="opwww">            <option value="0" ';if ($Think.session.adminoff==0){echo "selected=selected";};echo '>开启注册系统</option>            <option value="1" ';if ($Think.session.adminoff==1){echo "selected=selected";};echo '>关闭注册系统</option>          </select>     
Copy after login
      

这是什么鬼?你dump($test)看看能有值么?

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template