search

Home  >  Q&A  >  body text

Thinkphp3.2.3 cannot parse variables using U method in html template

The URL is generated correctly, but the variable after the parameter code is not parsed
I did not use the built-in template engine of thinkphp. I used samrty instead. The template suffix is ​​.html. Please help me.

世界只因有你世界只因有你2744 days ago1420

reply all(3)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-27 17:46:04

    The template tag is wrong, you need to add a colon, {:U(code)}. In addition, single quotes are used in U, so the variable cannot be parsed directly. You need to use . to splice strings! Such as: 'active='.$item[]

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-27 17:46:04

    Try this: U('url',array('size'=>14,'thick'=>25,'code'=>$info['CardNo']),false)
    This method There are three parameters, please refer to the TP documentation for details

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-27 17:46:04

    Your approach is wrong! The access mode of the url. It should be played like this
    U('controller/action/size/14') Hard-coded parameter names and parameter values
    U('controller/action/size/'.$info['size'].'/id/'.$info ['id']) variable value

    U('controller/action').'?id=12&size='.$info['size'] If you want to use ? method.

    Because U('controller/action') will generate controller/action.html
    So, you should write ? outside U('')

    reply
    0
  • Cancelreply