25 lines
388 B
PHP
25 lines
388 B
PHP
|
<?php
|
||
|
class news
|
||
|
{
|
||
|
var $db; //传入PDO对象
|
||
|
|
||
|
function __construct($db)
|
||
|
{
|
||
|
$this->db = $db;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
递归获得所有栏目
|
||
|
*/
|
||
|
function getAllCategory($hide = 0){
|
||
|
|
||
|
$sql = "SELECT c.* FROM news_category c
|
||
|
WHERE display>0
|
||
|
ORDER BY displayorder asc";
|
||
|
$re = $this->db->query($sql);
|
||
|
$categorys = $re->fetchAll();
|
||
|
|
||
|
return $categorys;
|
||
|
}
|
||
|
|
||
|
}
|