thinkphp5 查询数据库
Genius 发布于 阅读:56
控制层文件
<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
use app\before\model\Article;
class Before extends Controller
{
public function Index()
{
/* $sj = Db::name('article_cat')->select();
return json($sj);*/
$sj = Article::select();
return json($sj);
}
}
?>
模型层文件
<?php
namespace app\before\model;
use think\Model;
class Article extends Model
{
}
?>