F3-fatfree 简单使用

index.php

F3::route('GET /blog', 'blog->run');

 

 

app/blog.php

class blog extends F3instance {
 function beforeroute() {
  
 } 
 
 function run(){
  $data=DB::sql("select * from admin_group");
  $this->set("data",$data);

  print_r($data);
 }

 function afterroute() {
  
  echo Template::serve("blog.html");
 }
}

 

ui/blog.html

<include href="header.html"/>

<ul>
<repeat group="{{@data}}" value="{{@item}}">
<li>{{@item.name}}</li>
</repeat>
</ul>
{{count(@data)}}

 

你可能感兴趣的:(free)