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

懂 thinkPHP 的进来下,问个问题

  •  
  •   kisshere · Aug 16, 2014 · 3758 views
    This topic created in 4462 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
    xing393939
    Aug 16, 2014❤️1
    1
    模板的变量需要在程序里面用this->assign('var',$var); 声明之后才能使用
    ddzz
    ddzz
    Aug 16, 2014
    2
    V2EX竟然有用thinkPHP的?
    zts1993
    zts1993
    Aug 16, 2014
    3
    模板中是使用

    {$uid}

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