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 /** * 功能:生成缩略图 * 作者:phpox * 日期:Thu May 17 09:57:05 CST 2007 */ class CreatMiniature...

PHP socket 模拟POST 请求实例代码

我们用到最多的模拟POST请求几乎都是使用php curl来实现了,没考虑到PHP socket也可以实现,今天看到朋友写了一文章,下面我来给大家分享一下PHP socket模拟POST...

php运行提示:Fatal error Allowed memory size内存不足的解决方法

本文实例讲述了php运行提示:Fatal error Allowed memory size内存不足的解决方法。分享给大家供大家参考。具体方法如下: 有些朋友新配置的环境或自己新写的程序...

PHP学习 变量使用总结

1.定义常量define("CONSTANT", "Hello world."); 常量只能包含标量数据(boolean,integer,float 和 string)。 调用常量时,只...

php使用imagecopymerge()函数创建半透明水印

php使用imagecopymerge()函数创建半透明水印

使用imagecopymerge() 函数创建半透明水印,供大家参考,具体内容如下 <?php // 加载要加水印的图像 $im = imagecreatefromjp...