Welcome Guest, Not a member yet? Register   Sign In
Validate JSON?
#3

(09-23-2021, 04:13 AM)iRedds Wrote: When you call $this->validate($rules), the method will automatically try to determine the content type and retrieve data for validation.

When you call $this->validation->run($_POST), you yourself define the data to validate.

That's what I figured out, though it took me some time Smile.

As for $_POST, I was trying different things, it was late, I assigned request to this super global. I guess I will change it later to something like $jsonData so it doesn't say $_POST. 

This should result in the following.

PHP Code:
$this->validation->run($jsonData); 
Reply


Messages In This Thread
Validate JSON? - by wojtek_us - 09-22-2021, 09:38 AM
RE: Validate JSON? - by iRedds - 09-23-2021, 04:13 AM
RE: Validate JSON? - by wojtek_us - 09-23-2021, 07:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB