CI4 session_write_close() when redirect |
I am using CI4 an just learning and never using CI before.
I got this error: Code: PHP Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in [no active file]:0 Here my Controller: PHP Code: public function create() I already try dumb $Validation before PHP Code: dd( $validation = \Config\Services::validation()); when dumb show all the value. But after redirect there are no value error in validation and i got that error. what that i do wrong? best regards, Capah Maga
PHP Code: ->with('validation', $validation) You can't save $validation in the session like that. It's an instance of the validation library, that's why it crashes in session_write_close(). Here is an example to send the error messages to the redirected page. Use validate() to validate the rules, then use validator to get the error messages. You can see a detailed example in this tutorial: https://includebeer.com/en/blog/how-to-b...r-4-part-6 PHP Code: if ( ! $this->validate($rules)) |
Welcome Guest, Not a member yet? Register Sign In |