Interview question
How do you use cookies with different domains and paths? अलग-अलग domains और paths के साथ cookies?
Answer
setcookie('admin_token', $token, [
'path' => '/admin',
'secure' => true,
'httponly' => true
]);
setcookie('user_id', $id, [
'domain' => '.example.com',
'secure' => true
]);| Property | Purpose |
|---|---|
| path | Only send for requests to this path |
| domain | Restrict to domain and subdomains |
setcookie('admin_token', $token, [
'path' => '/admin',
'secure' => true
]);
setcookie('user_id', $id, [
'domain' => '.example.com',
'secure' => true
]);| Property | उद्देश्य |
|---|---|
| path | सिर्फ इस path के लिए |
| domain | Domain तक सीमित करना |
Was this answer clear?