PHP

Cookies in PHP (setcookie)

Në shqip: Cookie-t në PHP

ShpjegimiSQ

setcookie() i dërgon shfletuesit një cookie që e kthen me çdo kërkesë, dhe e lexon me $_COOKIE. Për cookie sesioni vendos gjithmonë httponly, secure dhe samesite.

EnglishEN

setcookie() sends the browser a cookie it returns with every request, and you read it with $_COOKIE. For session cookies always set httponly, secure and samesite.

Si ta mendosh

Si një biletë që shfletuesi e tregon sa herë kthehet.

Lexoje në anglisht

Like a ticket the browser shows every time it comes back.

Shembull kodiphp

<?php
setcookie("gjuha", "sq", [
  "expires" => time() + 86400 * 30,
  "secure" => true, "httponly" => true, "samesite" => "Lax",
]);

Terma të lidhur