简体   繁体   English

PHP strtotime无法与while数组一起使用

[英]PHP strtotime not working with while array

I have one question about setlocale and strftime. 我有一个关于setlocale和strftime的问题。 I have this query: 我有这个查询:

<?php   
$post_query = "SELECT * FROM posts WHERE post_id AND post_title = 'test' ORDER BY `post_id` DESC ";
$pp = mysql_query($post_query);
$pps = array();
while($row=mysql_fetch_array($pp)){
    $pps[] = $row;
}
?>

and i am using this echo : 我正在使用此回显:

<?php 
setlocale(LC_TIME, 'tr_TR.UTF-8');  
echo strftime("%d %B %Y ", strtotime($pps[0]['post_time'])); 
?>

but this code shows me 01 January 1970 . 但是这段代码向我显示了01 January 1970 What is the problem here anyone can tell me ? 有人可以告诉我这里有什么问题吗? What should I do here to show the correct time? 我应该在这里显示正确的时间吗?

try var_dump($pps); 尝试var_dump($pps); if you are having a problems post_time is not true. 如果您遇到问题, post_time不正确。 Take a look at your database table name post_time is true or not. 看一下数据库表名post_time是否为true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM