通知的结果print_f是这样的:
Array
(
[0] => Array
(
[notification_id] => 25
[notification_message] => ada
[notification_created_date] => 2016-06-30 15:25:32
)
[1] => Array
(
[notification_id] => 1
[notification_message] => qwdqdd
[notification_created_date] => 2016-06-22 15:27:01
)
)
我的观点是这样的:
<?php
foreach ($notification as $key => $value) {
?>
<li>
<?php
echo '<a href='.base_url().'notification/notif/'.$value['notification_id'].'>';
?>
<span class="time">
<?php
echo time_elapsed($value['notification_created_date']);
?>
</span>
<span class="details">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bookmark"></i>
</span> <?php echo $value['notification_message']; ?>
</span>
</a>
</li>
<?php
}
?>
我的助手(time_elapsed helper)是这样的:http://pastebin.com/AvsHYbxT
我的控制器中的构造是这样的:
public function __construct()
{
parent::__construct();
time_elapsed($created_date=NULL);
...
}
执行时,会出现如下错误:
"NetworkError: 500 Internal Server Error - http://localhost/my-application/dashboard"
当我将echo time_elapsed($value['notification_created_date']);
更改为echo time_elapsed('2016-06-30 15:26:35');
时,它正在运作。没有错误
所以,如果notification_created_date是静态的,则没有错误
如果notification_created_date是dinamyc,则存在错误
解决我问题的任何解决方案?