【zblog各种查】$zbp->GetUploadByID 根据类名表名ID 各种查

zblog1年前zblog问题解答13909

查询 表(映射类)

    $where = array();
    $where[] = array('=', 'log_Type', 0); # 类型:文章类型
    $where[] = array('=', 'log_Status', 0); # 状态:公开文章
    $where[] = array('>=', 'log_ID', 0);
    $where[] = array('<=', 'log_ID', 3);
    #print_r($zbp->db->sql->get()->select($zbp->table['Post'])->where($where)->orderBy(array('log_ID' => 'asc'))->limit(0, 0)->sql); # 返回sql语句(字符串类型)
    #print_r($zbp->db->sql->get()->select($zbp->table['Post'])->where($where)->orderBy(array('log_ID' => 'asc'))->limit(0, 0)); # 返回Object对象(SQL__MySQL 对象类型)class SQL__MySQL extends SQL__Global
    #die();
    # Get表映射类List()方法的参数应该是 SQL__Global 对象,而不能是sql语句。
    $articles = $zbp->GetPostList($zbp->db->sql->get()->select($zbp->table['Post'])->where($where)->orderBy(array('log_ID' => 'asc'))->limit(0, 0));
    if (count($articles) > 0) {
        foreach ($articles as $article) {
            echo $article->ID;
            echo $article->Title . PHP_EOL;
            echo $article->Content . PHP_EOL;
            echo $article->Url . PHP_EOL;
        }

    }
================



$upload = $zbp->GetUploadByID(645);## Upload是类名
print_r($upload->ID);
print_r($upload->Name);

查询任意建立分类映射的表的快捷方法

$array = $zbp->Getguiyi_ipwaf_logList('*', null, array('a_Id' => 'desc'), array(($p->PageNow - 1) * $p->PageCount, $p->PageCount), $op);
$categorys = $zbp->GetCategoryList('*', array('=', 'cate_RootID', 0)); # 获取顶级分类列表


# 查询一个数量 

guiyi_ip_log_table 为类名哦

$where = array(array('=', 'a_nianyueri', $day), array('=', 'a_Urlhost', $host));                                       
$pv = $zbp->db->Query($zbp->db->sql->get()->select($GLOBALS['guiyi_ip_log_table'])->column('COUNT(a_id) num')->where($where)->sql)[0]['num'];


查询一个数量

$num0 = $zbp->db->Query($zbp->db->sql->get()->select($zbp->table["Post"])->column('COUNT(log_ID) num')->where(array(array('=', 'log_Status', 0), array('=', 'log_Type', 0)))->sql)[0]['num'];



相关文章

php curl 典型案例代码 curl例子 curl_init() curl_setopt

      $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url);...

【蜘蛛蜘蛛蜘蛛】 搜索引擎蜘蛛大全 网站蜘蛛样本 bot spider 垃圾蜘蛛 屏蔽蜘蛛

蜘蛛样本 bingbot PetalBot Amazonbot  BLEXBot  MJ12bot  Googlebot&...

zblog链式sql不支持 ESCAPE  ,但是sqlite 必须要用ESCAPE ,硬改sql不优雅了

zblog链式sql不支持 ESCAPE ,但是sqlite 必须要用ESCAPE ,硬改sql不优雅了

/zb_system/function/lib/zblogphp.php通过用户名获取用户实例(不区分大小写). public function GetMemberByN...

蜘蛛 爬虫 7大蜘蛛

百度    baidu     baiduspiderBing   bing      bingbot谷歌  ...

(文件名特殊字符过滤)文件夹或文件名字中不能使用的特殊字符共有9个,过滤文件名中的特殊字符,并处理过滤后长度为0的情况

# 过滤文件名中的特殊字符,并处理过滤后长度为0的情况 function guiyi_txt_sanitize_file_name($fileName) {  &n...