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

yipeiwu_com5年前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仿QQ验证码的实例分析

有需要的朋友,参考下吧。 复制代码 代码如下:<?php/** * 仿QQ验证码*///Session保存路径$sessSavePath = dirname(__FILE...

php获取网页里所有图片并存入数组的方法

本文实例讲述了php获取网页里所有图片并存入数组的方法。分享给大家供大家参考。具体如下: $images = array(); preg_match_all('/(img|src)=...

PHP 缓存实现代码及详细注释

复制代码 代码如下:class CacheException extends Exception {} /** * 缓存抽象类 */ abstract class Cache_Abstr...

PHP中define() 与 const定义常量的区别详解

本文实例讲述了PHP中define() 与 const定义常量的区别。分享给大家供大家参考,具体如下: 前言 今天在Stackoverflow又看到一个很有趣的文章,所以翻译过后摘了过来...

MacOS 安装 PHP的图片裁剪扩展Tclip

Tclip 用于图片裁剪,有以下特点: 能进行人脸识别。图片中有人脸,将自动视为人脸区域为重要区域,将不会被裁剪掉。 自动识别其它重要区域。如果图片中未识别出人脸,则会根据特征分布计算出...