dousongxuan7507 2018-10-01 18:39
浏览 16
已采纳

当filter_input返回不正确的cookie值时

I set cookie by this code

setcookie($cookieName, $value);

And get cookie by this

filter_input(INPUT_COOKIE, $cookieName);

But I get wrong value. Can you help?

  • 写回答

1条回答 默认 最新

  • dpd3982 2018-10-01 18:46
    关注

    Look how you use the code written by you, if you perform both actions on one script, then this is a logical result. Try this instead:

    Set cookie:

    setcookie($cookieName, $value);
    

    Update your web page. And then get cookie:

    filter_input(INPUT_COOKIE, $cookieName);
    

    Hope this is resolve your issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 跑hls xfopencv的例程standalone_hls_axi_example出的错误,csim没问题,c synthesis出的错误
  • ¥15 sqlserver update语句逐行生效
  • ¥15 mssql2000游标循环次数对不上
  • ¥20 Windows10系统命令行调用
  • ¥15 php环境如何实现国密SM2相关功能
  • ¥15 关于#单片机#的问题:K210 例程里面提示我iomem.h: No such file or directory
  • ¥15 LSPI算法的大问题
  • ¥15 java导出word 动态填充数据
  • ¥20 扑克的算牌公式及软件制作
  • ¥20 如何通过云图中RPG去计算云图上不同位置的值?