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中配置文件操作 如config.php文件的读取修改等操作

复制代码 代码如下: <?php $name="admin";//kkkk $bb='234'; $db=4561321; $kkk="admin"; ?> 函数定义: 配...

php简单浏览目录内容的实现代码

如下所示:复制代码 代码如下:<?php$dir = dirname(__FILE__);$open_dir = opendir($dir);echo "<table bor...

关于ob_get_contents(),ob_end_clean(),ob_start(),的具体用法详解

ob_get_contents();ob_end_clean();ob_start()使用ob_start()把输出那同输出到缓冲区,而不是到浏览器。然后用ob_get_contents...

php实现算术验证码功能

最近学了php的图像函数,也练习的验证码的实现,在听从老师的建议下,自己写了一个算术验证码的函数,第一次自己独立完成一个小练习,感觉挺开心的。但是,也知道自己的局限,所以特意写出来,希望...

PHP7下协程的实现方法详解

前言 相信大家都听说过『协程』这个概念吧。 但是有些同学对这个概念似懂非懂,不知道怎么实现,怎么用,用在哪,甚至有些人认为yield就是协程! 我始终相信,如果你无法准确地表达出一个知...