Home  >  Article  >  Backend Development  >  How to use thinkPHP's Html template tag_PHP tutorial

How to use thinkPHP's Html template tag_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:14:27844browse

Note: Before using tags such as , you must import the TP tag library:

If we now need a select drop-down menu item, then in ThinkPHP we can do this.

1. Get data in the method of 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

Copy the code The code is as follows:





In this way, we only use a simple tag to achieve the following functions: (Compiled HTML code)

Copy code The code is as follows:


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326315.htmlTechArticleNote: Before using tags such as html:select / etc., you must introduce the TP tag library: tagLib name= "html" / If we need a select drop-down menu item now, then in ThinkPHP we...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn