This article mainly introduces how to use Html template tags in thinkPHP. It has a certain reference value. Now I share it with you. Friends in need can refer to it
If we need a select drop-down menu now item, then we can do this in ThinkPHP
Note: Before using tags such as
If we need a select drop-down menu item now, we can do this in ThinkPHP.
1. Obtain data in the method of the Action controller, for example:
##Copy code The code is as follows:
public function mylist(){ $user = new Model(‘User'); $list = $user->getField(‘id,username'); $this->assign(‘users',$list); $this->display(); }
2. Import the tag library into the template page and write the following code
The code is as follows:<tagLib name="html" />
<html:select name="uid" options="users" first="请选择用户" change="alert(‘Hello')"/>
##Copy code
<select id="" name="uid" onchange="alert(‘Hello')" ondblclick="" class=""> <option value="">请选择用户</option> <option value="1″>no1</option> <option value="2″>no2</option> <option value="3″>no3</option> <option value="4″>no4</option> </select>
ThinkPHP template judgment output Empty tag usage
Use thinkphp’s own method to generate static html files
The above is the detailed content of How to use thinkPHP's Html template tags. For more information, please follow other related articles on the PHP Chinese website!