New Request Class |
Hi.
I want to offer the use of a new class of global arrays. I know that there is already a class Input, but not very useful. Input class does not clear the data and does not lead to the desired type. I think this is a better solution than the input class: PHP Code: public post ([string $name], [string|array $filters], [mixed $default]) Example: PHP Code: $name = $this->request->post('name', array('trim', 'striptags')); As for XSS, I think the data must be escaped in a template, because there is a violation of data integrity, if it is done in Input Class. If users will consider a class of useful I can show the class code. Sorry for my english.
The form validation class already do that (filter, trim, etc)
As for data type, you can type cast the result : $id = (int)$this->input->get('id');
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |