• 请不要在回答技术问题时复制粘贴 AI 生成的内容
kisshere
V2EX  ›  程序员

懂 thinkPHP 的进来下,问个问题

  •  
  •   kisshere · Aug 16, 2014 · 3611 views
    This topic created in 4374 days ago, the information mentioned may be changed or developed.
    在baseAction中我已经设定好了全局action的uid:$this->uid=$user_id;为什么在模板中使用$this->uid不能输出值?
    16 replies    2014-08-18 08:35:40 +08:00
    xing393939
        1
    xing393939  
       Aug 16, 2014   ❤️ 1
    模板的变量需要在程序里面用this->assign('var',$var); 声明之后才能使用
    ddzz
        2
    ddzz  
       Aug 16, 2014
    V2EX竟然有用thinkPHP的?
    zts1993
        3
    zts1993  
       Aug 16, 2014
    模板中是使用

    {$uid}

    输出吧
    leafx
        4
    leafx  
       Aug 16, 2014
    @ddzz 哈哈 TP人到处都是的 - - 所以。。。。
    wozhapen
        5
    wozhapen  
       Aug 16, 2014   ❤️ 1
    先在action中,this->assign('uid',$user_id);
    然后在模板中使用{$uid}
    markmx
        6
    markmx  
       Aug 16, 2014
    @ddzz 为什么不能用 thinkphp呢?
    mahone3297
        7
    mahone3297  
       Aug 16, 2014
    @markmx 应该是让人感觉b格有点低。。。
    kisshere
        8
    kisshere  
    OP
       Aug 16, 2014
    @ddzz 求大神您的作品,我的钛合金狗眼急需要阁下HTML6+CSS4+日ip超1000W的网站滋养
    good
        9
    good  
       Aug 16, 2014
    @wozhapen $this->uid=$user_id Thinkphp 3.0后是支持这种写法的 模板中 使用{$uid}
    @kisshere 这种问题去Thinkphp官网问给好吧 手册教程什么的都比较全啊
    muziyue
        10
    muziyue  
       Aug 16, 2014
    @markmx 我看了看那人发言记录,基本都是贬低别人提高自己逼格的,最烦这种
    tushiner
        11
    tushiner  
       Aug 16, 2014
    @muziyue 我也看了下他以往的评论,果真是你说的那样
    wozhapen
        12
    wozhapen  
       Aug 17, 2014
    @good 受教了。。
    members
        13
    members  
       Aug 18, 2014 via Android
    @good
    members
        14
    members  
       Aug 18, 2014 via Android
    服了楼主,TP的基础性问题都不会,以往的评论还各种贬低别人。
    kisshere
        15
    kisshere  
    OP
       Aug 18, 2014
    @hackwjfz 哈哈,第一次接触thinkphp,难免有些生疏嘛
    kisshere
        16
    kisshere  
    OP
       Aug 18, 2014
    @hackwjfz 我以前什么时候贬低过别人呀?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3335 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 10:33 · PVG 18:33 · LAX 03:33 · JFK 06:33
    ♥ Do have faith in what you're doing.