Php日期在服务器上不工作
由于某些原因,Php日期在服务器上不起作用 以下是显示每日提示的功能。我正在使用codeigniter框架。在下面的函数中,我试图打印一年中的某一天($doy)。当我转到url并尝试访问tip函数时,它会显示一个空白页面。一年中的哪一天不打印Php日期在服务器上不工作,php,codeigniter,date,Php,Codeigniter,Date,由于某些原因,Php日期在服务器上不起作用 以下是显示每日提示的功能。我正在使用codeigniter框架。在下面的函数中,我试图打印一年中的某一天($doy)。当我转到url并尝试访问tip函数时,它会显示一个空白页面。一年中的哪一天不打印 public function tip(){ $idCount = $this->db->query('SELECT Count(*) AS COUNT FROM clickmag_tip')->result();
public function tip(){
$idCount = $this->db->query('SELECT Count(*) AS COUNT FROM clickmag_tip')->result();
$total = $idCount[0]->COUNT;
$time = time();
$doy = mdate('%z', $time);
echo $doy;
//$day_of_year = date('z',time());
//$doyear = date("z") + 1;
//echo $doyear;
$s = mktime(date("G") + 1);
print date("Y/m/d h:i:s a", $s);
if($total > 0){
$offset = $doy % $total ;
}
$data = $this->db->query('SELECT * FROM table_tip LIMIT 1 OFFSET '. $offset);
header('Content-type: text/json');
header('Content-type: application/json');
echo json_encode($data->result());
}
你认为问题出在哪里?我和服务器人员谈过,但他们也不知道。
我怎样才能解决这个问题
提前谢谢 在输出任何内容之前,必须输出所有标题 你们都有:
echo$doy代码>
及
打印日期(“Y/m/d h:i:s a”,$s)代码>
以前
header('Content-type: text/json');
header('Content-type: application/json');
这就是导致空白页的原因。
Error报告(EALALL);ini设置(“显示错误”,真);冲洗();将这些代码添加到php页面的开头,然后尝试加载。空白页面也可能由页面中的某些语法错误导致。此外,没有函数mdate()
echo$doy
启动输出,因此在此之后不能发送头。@JohnWatson-mdate()
是一个codeigniter函数。