CI4 Event methods not firing |
Hi, I am trying to use Events to call some methods but the methods I'm calling aren't being fired. Here is an example:
Config\Autoload.php: Code: public $classmap = [ Code: namespace App\Libraries; Code: use App\Libraries\MyClass; Thanks for your help!
It seems your code works fine, but you need to remove `exit`.
You should not use exit, because it terminates the framework working. What if you write something to log file, not var_dump()?
(07-13-2022, 12:27 AM)kenjis Wrote: It seems your code works fine, but you need to remove `exit`. Thank you for your reply! Even if I take out the exit, this code still does not work for me. 'Test success' never gets printed on my page. This is just a simplified example I am using, which I have tried in my current project without success. I am upgrading my company's project from CI3 and my goal is to check a log file and a session file on the post_controller_constructor event and then write to a session file on the post_system event. I am having trouble getting these methods to actually run on those events though, just like in my example
I was using version 4.1.8, once I upgraded the system files to version 4.2.1 the event methods started to work!
|
Welcome Guest, Not a member yet? Register Sign In |