Call to undefined function now()

2019-09-14 02:34发布

问题:

I'm using the Ion Auth library for the authentication system in a website I'm working on. It worked without any problem, but since yesterday I'm getting this error:

PHP Fatal error:  Call to undefined function now() in /home/carlo/public_html/website/application/models/ion_auth_model.php on line 996

The code in that line is this:

        $this->db->update($this->tables['users'], array('last_login' => now()), array('id' => $id));

I read that now() is a mysql function and in php you should use date(), but it seems strange to me that in the library there is a non existing function. Any idea what's happening here?

回答1:

Use Codeigniters date hepler, it will allow you to use now().

$this->load->helper('date');