Skip to content

Instantly share code, notes, and snippets.

@erlangparasu
Created March 17, 2017 11:29
Show Gist options
  • Save erlangparasu/68b44358ce2bc403fa079e78509b5600 to your computer and use it in GitHub Desktop.
Save erlangparasu/68b44358ce2bc403fa079e78509b5600 to your computer and use it in GitHub Desktop.
Generate random token in PHP
$length = 32;
$str_bytes = openssl_random_pseudo_bytes($length);
$csrf_token_new = base64_encode($str_bytes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment