第9个评论
@foreach ($pages as $page)
<li >
<div class="title">
<a href="{{ URL('pages/'.$page->id) }}">
<h4>{{ $page->title }}</h4>
</a>
</div>
<div class="body">
<p>{{ $page->body }}</p>
</div>
</li>
@endforeach
@foreach ($pages as $page)
<li >
<div class="title">
<a href="{{ URL('pages/'.$page->id) }}">
<h4>{{ $page->title }}</h4>
</a>
</div>
<div class="body">
<p>{{ $page->body }}</p>
</div>
</li>
@endforeach
和Yii2太像了,这也算节约学习成本嘛
$role = new Role();
$role->id = Common::generateID();
$role->name = Yii::$app->request->post('name');
$role->state = '1';
if($role->save()){
return "success";
}else{
return "fail";
}
$role = new Role();
$role->id = Common::generateID();
$role->name = Yii::$app->request->post('name');
$role->state = '1';
if($role->save()){
return "success";
}else{
return "fail";
}
2017-01-10
可以看看Yii2的ActiveRecord,
$dictItem = Dictitem::find()
->where(['dictCode' => 'DICT_STATE'])
->all();
$role =Role::findOne($id);
$dictItem = Dictitem::find()
->where(['dictCode' => 'DICT_STATE'])
->all();
$role =Role::findOne($id);
2017-01-10