<pre name="code" class="python"><!doctype html> <html lang="en"> <head> <meta name="Generator" content="EditPlus?"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>Document</title> </head> <body> <h1>helloworld <{$data}></h1> <volist name='data' id='vo'> <{$vo.ip}>---<{$vo.info}>--<{$vo.env}> </volist> </body> </html> 'TMPL_L_DELIM'=>'<{', //配置左定界符 'TMPL_R_DELIM'=>'}>', //配置右定界符 public function env(){ $m=new Model('machine_info'); $arr=$m->select(); //var_dump($arr); //$name="赵杨健"; // $this->assign('data',$arr[0]['ip']); $this->assign('data',$arr); $this->display(); } 后台分配数据 ,html获取数据 模板可以遍历数组: <{$vo.ip}>---<{$vo.info}>--<{$vo.env}> 开启调试功能的page_trace 1.开启调试功能 //开启调试模式 define('APP_DEBUG',true); 2.我们需要设置配置文件,开启页面trace <?php return array( 'TMPL_L_DELIM'=>'<{', //配置左定界符 'TMPL_R_DELIM'=>'}>', //配置右定界符 'DB_TYPE'=>'mysql', 'DB_HOST'=>'192.168.32.79', 'DB_NAME'=>'devops', 'DB_USER'=>'root', 'DB_PWD'=>'1234567', 'DB_port'=>'3306', 'DB_PREFIX'=>'', 'DB_DSN'=>'mysql://root:1234567@192.168.32.79:3306/devops', 'SHOW_PAGE_TRACE'=>true,//开启页面Trace ); ?>