【发布时间】:2018-04-11 07:59:10
【问题描述】:
我是 CodeIgniter 的新手,但对 Symfony 等 MVC 框架非常熟悉。
我正在更改自定义帮助函数,我正在从数据库中检索数据。我认为数据库检索不起作用,但我没有收到任何错误。辅助函数只是忽略错误。日志文件中没有错误(log_threshold = 4),并且 die() 也被忽略了。
我将在下面发布辅助函数,但我的问题不是我的代码有什么问题(如果有的话),问题是为什么错误和 die() 被忽略了,我能做些什么来解决这个问题?
function getRates() {
$ci=& get_instance();
$ci->load->database();
$ci->db->select('currency_values.*');
$ci->db->from('version1.currency_values');
$currencyValues = $ci->db->get();
$lastUpdated = strtotime($currencyValues->result()[0]->last_updated);
die(">>> $lastUpdated <<<"); //This gets ignored
if ($lastUpdated > time() - 600)
{
//Code here that SHOULD be running
}
else
{
//Code here that ALWAYS runs, most likely because db retrieval is not working
}
【问题讨论】:
-
您确定包含该函数的帮助文件已加载吗?
标签: php codeigniter helpers