Thinkphp3.2.3 cannot parse variables using U method in html template
世界只因有你2017-05-27 17:44:04
0
3
1431
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.
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[]
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
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('')
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[]
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
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('')