→ kerash:php?? html ?? 06/29 18:03
→ tas72732002:php 06/29 18:03
→ tas72732002:頁面reload 仍無法取得 06/29 18:03
→ kerash:所以你open html? 06/29 18:03
→ kerash:有rewrite過嗎? 06/29 18:04
→ tas72732002:我寫錯 open的子視窗也是php的頁面 06/29 18:07
→ kerash:setcookie 第四個參數是拿來設定 path 的 06/29 18:09
→ kerash:原domain=> www.domain.com/ 設定的 cookie 若在底下dir中 06/29 18:09
→ kerash:如 www.domain.com/dir1/t2.php 設定 cookie 的話 06/29 18:10
→ kerash:那在設定時要把 setcookie 第4個參數設 "/" 表主目錄下共用 06/29 18:10
→ kerash:否則 cookie 的 path 是會在你 /dir1 底下共用, / 抓不到 06/29 18:11
→ tas72732002:第四個參數我有設定/ 06/29 18:14
→ tas72732002:還是抓不到 06/29 18:14
→ tas72732002:第五個參數應該不用 06/29 18:15
→ tas72732002:因為我是同個網域 06/29 18:15
→ kerash:我測試下是可以,你用 chrome開F12找resource的cookie吧 06/29 18:15
→ kerash:記得cookie設定之前不能有header輸出 06/29 18:16
→ kerash:要在最前面才有效 06/29 18:16
→ tas72732002:chrome有,但就是取不到.........y 06/29 18:26
→ tas72732002:發現expire time 是1969........ 寫入是正確的時間~~~ 06/29 18:59
→ tas72732002:setcookie("test","123456",$now+3600,"/"); 06/29 19:04
→ tas72732002:這有問題嗎? 06/29 19:05
推 kerash:now是多少... ? 他是算秒數所以+3600應該沒問題 06/29 21:44
→ tas72732002:取得time()的時間+3600 06/30 11:26
→ tas72732002:應該沒有問題,chrome expire time是1969年 06/30 11:27
→ kerash:expire time 是 1969 年就有問題啦... 你的code只有這樣嗎? 06/30 16:49
→ kerash:你直接把$now改成time寫在裡面試試看 06/30 16:50