LoginSignup
0
3

More than 5 years have passed since last update.

「.」が入っているcookieが取得出来ない

Posted at

こういうクッキーがあったとする(GTMで作成する時はこういうクッキーで投げられる事がある?)

hoge.fuga

その場合PHPの「$_COOKIE」を使った場合いつもどおり

$_COOKIE['hoge.fuga']

で取得しようとすると、undefinedになる。

中身を確認すると

$_COOKIE => ['hoge_fuga']

と「.」の部分が「_」に変更されている事がわかるので
取得する時は

$_COOKIE['hoge_fuga']

で取りましょう。

PHP以外では試してないので他の場合はどうなるかは未検証!!
取得出来ない場合は先入観捨てて、さっさと全取得等でどう書けば取得出来るか確認しよう!

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3