PHP code example of hahadu / im-blog-think
1. Go to this page and download the library: Download hahadu/im-blog-think library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hahadu / im-blog-think example snippets
namespace app\blog\controller;
use Hahadu\ImBlogThink\Controller\BaseBlogHomeController;
use think\App;
use think\facade\View;
class IndexController extends BaseBlogHomeController
{
public function __construct(App $app)
{
parent::__construct($app);
$result = $this->get_home_info(); //获取页面常用信息
View::assign($result);
}
//文章首页
public function index()
{
$blogs = $this->blog->getPageData();
return view('',$blogs);
}
//按文章分类查询
public function category($cid)
{
$result = parent::category($cid);
if(is_int($result)){
return jump_page($result);
}else{
return view('',$result);
}
}
//文章页
public function detail($id)
{
$result = parent::detail($id);
if(is_int($result)){
return jump_page($result);
}else{
return view('',$result);
}
}
//按标签查询
public function tag($tid)
{
$result = parent::tag($tid);
if(is_int($result)){
return jump_page($result);
}else{
return view('',$result);
}
}
//站内搜索
public function search($search)
{
$assign = parent::search($search);
return view('',$assign);
}
//处理提交评论
public function comment()
{
$result = parent::comment();
return jump_page($result);
}
}