DateTime php function causing error |
As they said, it's a namespace issues. If your controller is namespaced as App\Controllers, then any new class you try to instantiate will assume it's in App\Controllers, also, which DateTime obviously isn't. So you have to tell PHP to look for it in the root namespace, by prefixing with the backslash.
Additionally - CI4 provides a new Time class that can do what you're wanting to do, and more. |
Messages In This Thread |
DateTime php function causing error - by kick - 05-24-2020, 11:10 AM
RE: DateTime php function causing error - by dave friend - 05-24-2020, 04:51 PM
RE: DateTime php function causing error - by Zakawa - 05-25-2020, 06:27 AM
RE: DateTime php function causing error - by kilishan - 05-25-2020, 08:53 AM
|