Skip to content

Instantly share code, notes, and snippets.

@jjjjcccjjf
Created February 7, 2019 02:35
Show Gist options
  • Save jjjjcccjjf/30c5b818b2f7d33e753d8b8a5d16dd0a to your computer and use it in GitHub Desktop.
Save jjjjcccjjf/30c5b818b2f7d33e753d8b8a5d16dd0a to your computer and use it in GitHub Desktop.

Restigniter

How to sanitize inputs

$this->input->post('key', true); # for single key post variable
$this->input->post(null, true) # for the whole post object

How to escape json properly

echo json_encode($res, JSON_HEX_APOS|JSON_HEX_QUOT); # for escaping special characters such as single quotes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment