PHP文章按日期(月日)SQL归档语句

yipeiwu_com6年前PHP代码库
复制代码 代码如下:

select FROM_UNIXTIME(pubtime, '%Y-%m') as pubtime, count(*) as cnt from articles group by FROM_UNIXTIME(pubtime, '%Y-%m')

PHP文章按日期(日)SQL归档
复制代码 代码如下:

select FROM_UNIXTIME(pubtime, '%Y-%m-%d') as pubtime, count(*) as cnt from articles group by FROM_UNIXTIME(pubtime, '%Y-%m-%d')

非时间戳日期格式归档(date_format格式化日期)
复制代码 代码如下:

select date_format(`post_date`,'%Y%m%d') as pubtime, count(*) as cnt from wp_posts where `post_status`='publish' group by date_format(`post_date`,'%Y%m%d') order by `ID` desc
select date_format(`post_date`,'%Y%m%d') as pubtime,date_format(`post_date`,'%m 月 %d 日') as shijian,count(*) as cnt from wp_posts where `post_status`='publish' group by date_format(`post_date`,'%Y%m%d') order by `ID` desc limit 0,7

相关文章

基于PHP服务端图片生成缩略图的方法详解

复制代码 代码如下:<?php//定义缩略图片尺寸$picSize = array(        ...

克隆一个新项目的快捷方式

克隆一个新项目的快捷方式

有没想过最土的项目如何快速复制出一个来,然后改改就成新的团购项目了? 或者说编辑一个老项目的时候想把他另存为一个新项目而不是保存, 看下图 红色部分 具体开发代码(非细节),如下 修改...

php漏洞之跨网站请求伪造与防止伪造方法

伪造跨站请求介绍伪造跨站请求比较难以防范,而且危害巨大,攻击者可以通过这种方式恶作剧,发spam信息,删除数据等等。这种攻击常见的表现形式有:   伪造链接,引诱用户点击,或是让用户在不...

IIS7.X配置PHP运行环境小结

IIS7.X配置PHP运行环境小结

一、使用IIS运行PHP程序 1.首先下载PHP,这里我下载的是php5.2.14(如果是其他高版本的话可能找不到php5isapi.dll,其相关配置方法暂且不论),建议下载zip压...

php面向对象程序设计中self与static的区别分析

本文实例讲述了php面向对象程序设计中self与static的区别。分享给大家供大家参考,具体如下: 1、假设我们有个Car类,它有2个方法:model()和getModel()。...