本文整理汇总了PHP中Website::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Website::find方法的具体用法?PHP Website::find怎么用?PHP Website::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Website
的用法示例。
在下文中一共展示了Website::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reAction
public function reAction($token)
{
$item = Website::find(array('conditions' => 'token = ?1', 'bind' => array(1 => $token), 'cache' => array('key' => $token, 'lifetime' => 7200 * 24)))->getFirst();
if ($item) {
$item->vote += rand(1, 10);
$item->save();
$this->response->redirect($item->href, true);
} else {
$this->response->redirect('/', true);
}
}
示例2: home
/**
* [home 网站设置]
* @return [type] [description]
*/
public function home()
{
if (IS_POST) {
$data = ['web_title' => I('post.web_title'), 'web_keyword' => I('post.web_keyword'), 'web_desription' => I('post.web_desription'), 'web_footer' => I('post.web_footer')];
Website::where(['id' => 1])->update($data);
View::success('更新成功');
die;
}
$webData = Website::find(1)->toArray();
//print_r($webData);
$this->smarty->assign('webData', $webData);
$this->smarty->assign('title', '网站设置_ISisWeb中文网后台管理_ISirPHPFramework');
$this->smarty->display('Admin/System/home.html');
die;
// $this->view = View::make('/Admin/System/home')
// ->with('webData',$webData)
// ->with('title','网站设置_ISirWeb中文网');
}
示例3: artice
/**
* [artice 文章内容]
* @return [type] [description]
*/
public function artice($slug)
{
$webSite = Website::find(1)->toArray();
$arcData = Article::with('belongsToCategory')->find($slug)->toArray();
//print_r($arcData);
$hotArcData = Article::with('belongsToCategory')->where(['is_del' => 0])->get()->toArray();
$linkData = Link::where(['is_look' => 1])->get()->toArray();
//print_r($linkData);
$cateData = Category::where(['is_del' => 0])->get()->toArray();
//print_r($cateData);
$item = [];
foreach ($cateData as $k => $v) {
if (!isset($item[$v['id']])) {
$item[$v['id']] = $v;
} else {
$item[$v['id']] = $v;
}
}
//上一篇
$pre = Article::get_pre($slug);
//print_r($pre);
//下一篇
$next = Article::get_next($slug);
//print_r($next);
//相关文章
$this->smarty->assign('pre', $pre);
$this->smarty->assign('next', $next);
$this->smarty->assign('webSite', $webSite);
$this->smarty->assign('hotArcData', $hotArcData);
$this->smarty->assign('cateData', $item);
$this->smarty->assign('slug', $slug);
$this->smarty->assign('linkData', $linkData);
$this->smarty->assign('article', $arcData);
$this->smarty->display('Index/article.html');
}