Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created September 19, 2019 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/36a2fa86c4cfa8815bb09e82980271cf to your computer and use it in GitHub Desktop.
Save parzibyte/36a2fa86c4cfa8815bb09e82980271cf to your computer and use it in GitHub Desktop.
<?php
public function gc($tiempo_de_vida)
{
#Calculamos el tiempo actual menos el tiempo de vida.
$caducidad = time() - $tiempo_de_vida;
$sentencia = $this->base_de_datos->prepare("DELETE FROM sesiones WHERE ultimo_acceso < ?;");
return $sentencia->execute([$caducidad]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment