使用 setcookie 函数设置 cookie 报错,报错信息为:

setcookie() expects parameter  to be integer, float given in...

错误代码

setcookie("user_name", $username, time()+, "/"); 

一开始以为是 https 的问题,后来修改为 http only 也不行,最后发现原来是设置 cookie 过期的时间戳太大,从报错信息看也是显示第三个参数错误,

试着把时间戳调小一点..居然没报错了,看来确实是时间戳的问题。
突然想起,时间戳的最大值是到 2038年 (32位),一查,果然超了。
再看看配置文件,写的是66 * 265 * 86400,居然是66年过期,已经超过了PHP的setcookie函数处理范围
把配置调小,错误立马解决

cookie 设置报错 setcookie() expects parameter 3 to be integer, float given in...的更多相关文章

  1. laravel 报错htmlspecialchars() expects parameter 1 to be string, object given

    翻译过来就是     期望参数1是字符串 意思就是说变量为数组,应以数组的方式输出 @foreach($xxx as $k=>$y) {{$k}}{{$y}} @endforeach

  2. php报错:strip_tags() expects parameter 1 to be string, array given

    囧....... 这个表示参数需要字符串,而你传入了数组,所以出错了~ 检查下函数或者方法是否正确,还有参数

  3. Warning: setcookie() expects parameter 3 to be long, string given

    Warning: setcookie() expects parameter 3 to be long, string given 这个是我用php7.0会报这个错误, 切换低版本php5.6就ok

  4. 完美解决 scipy.misc.imread 报错 TypeError: Image data cannot be converted to float

    File "/home/harrison/anaconda3/lib/python3.7/site-packages/matplotlib/image.py", line 634, ...

  5. php 怎么设置报错级别 和 控制报错[转]

    在Windows环境下:有时在其他环境下运行正常的程序在自己的环境上会报错误    程序会 报出  Undefined index:   这样的错误例如有如下的代码:                  ...

  6. php 设置报错等级

    定义和用法:    error_reporting() 设置 PHP 的报错级别并返回当前级别. 函数语法:    error_reporting(report_level) 如果参数 level 未 ...

  7. SQL注入之Sqli-labs系列第二十一关(基于复杂性的cookie POST报错注入)和二十二关(基于双引号的cookie POST报错注入)

    开始挑战第二十一关(Cookie Injection- Error Based- complex - string) 和二十二关(Cookie Injection- Error Based- Doub ...

  8. php设置报错级别

    ini_set("display_errors", "On");//若页面不报错的话,请设置php.ini 的display_errors 为 On error ...

  9. 11 ~ express ~ 解决 cookie 中文报错的问题

    使用cookies包需要注意:1,cookie中是不能有中文的,一旦有中文,就会报错2,cookie是通过 中间件的形式直接挂载到 req对象上的,那么cookies有的方法,req.cookies就 ...

随机推荐

  1. fastjson 将json字符串转化成List<Map<String, Object>>

    亲测可行,如下: JSON.parseObject(jsonstr, new TypeReference<List<Map<String, Object>>>() ...

  2. 【Mysql】Mysql root用户误删了或只剩下没有任何操作权限的用户怎么办

     一.操作步骤 1.停止mysql服务:在mysql安装目录下找到mysqld.cnf:在mysqld.cnf中找到以下片段[mysqld]:另起一行加入代码:skip-grant-tables 并保 ...

  3. linux设备驱动程序--sysfs用户接口的使用

    linux sysfs文件系统 本文部分内容参考自官方文档 自2.6版本开始,linux内核开始使用sysfs文件系统,它的作用是将设备和驱动程序的信息导出到用户空间,方便了用户读取设备信息,同时支持 ...

  4. python的sort和sorted

    sort 只适用于列表,返回列表类型. sorted 可适用于字典,元组和列表. 使用方法 sort的使用方法是list.sort(cmp=None, key=None, reverse=False) ...

  5. 矩阵LU分解程序实现(Matlab)

    n=4;%确定需要LU分解的矩阵维数 %A=zeros(n,n); L=eye(n,n);P=eye(n,n);U=zeros(n,n);%初始化矩阵 tempU=zeros(1,n);tempP=z ...

  6. 谷歌浏览器打开不了Axure生成的html文件

    1.首先要进行翻墙.https://www.google.com 搜索Axure chrome软件 2. 3.安装axure插件即可. 4.管理扩展程序,允许访问文件网址.

  7. For 32-bit BOOL is a signed char, whereas under 64-bit it is a bool.

    https://stackoverflow.com/questions/31267325/bool-with-64-bit-on-ios/31270249#31270249 Definition of ...

  8. LeetCode 1091. Shortest Path in Binary Matrix

    原题链接在这里:https://leetcode.com/problems/shortest-path-in-binary-matrix/ 题目: In an N by N square grid, ...

  9. 解决国内 Pip 安装速度慢

    1. Windows 在 C:\Users\(用户名)新建文件 pip.ini 2. 编辑 pip.ini 文件 [global]# 防止超时,默认值为 100timeout = 1000# 地址可从 ...

  10. 如何查看WinDbg扩展有哪些命令

    如果您想查看任何windbg扩展所支持的命令,可以采用各种方法. 你可以用!<ext_name>.help命令查看该扩展支持的所有命令.用扩展模块名替换<ext_name>.( ...