cookie 设置报错 setcookie() expects parameter 3 to be integer, float given in...
使用 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...的更多相关文章
- laravel 报错htmlspecialchars() expects parameter 1 to be string, object given
翻译过来就是 期望参数1是字符串 意思就是说变量为数组,应以数组的方式输出 @foreach($xxx as $k=>$y) {{$k}}{{$y}} @endforeach
- php报错:strip_tags() expects parameter 1 to be string, array given
囧....... 这个表示参数需要字符串,而你传入了数组,所以出错了~ 检查下函数或者方法是否正确,还有参数
- 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
- 完美解决 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, ...
- php 怎么设置报错级别 和 控制报错[转]
在Windows环境下:有时在其他环境下运行正常的程序在自己的环境上会报错误 程序会 报出 Undefined index: 这样的错误例如有如下的代码: ...
- php 设置报错等级
定义和用法: error_reporting() 设置 PHP 的报错级别并返回当前级别. 函数语法: error_reporting(report_level) 如果参数 level 未 ...
- SQL注入之Sqli-labs系列第二十一关(基于复杂性的cookie POST报错注入)和二十二关(基于双引号的cookie POST报错注入)
开始挑战第二十一关(Cookie Injection- Error Based- complex - string) 和二十二关(Cookie Injection- Error Based- Doub ...
- php设置报错级别
ini_set("display_errors", "On");//若页面不报错的话,请设置php.ini 的display_errors 为 On error ...
- 11 ~ express ~ 解决 cookie 中文报错的问题
使用cookies包需要注意:1,cookie中是不能有中文的,一旦有中文,就会报错2,cookie是通过 中间件的形式直接挂载到 req对象上的,那么cookies有的方法,req.cookies就 ...
随机推荐
- 浅析ORACLE ERP系统维护方法
笔者曾从事ORACLE ERP系统客户服务工作多年,在ERP系统维护工作中,深深体会到:ERP的系统维护工作看似平常,实则大有学问. ORACLE ERP系统是一个大型集成的软件系统,是一个企业全面共 ...
- git commit 之后,撤销commit操作
撤销.修改commit 写代码过程中,如果已经git add [files] git -m commit [files],没有push代码到远程仓库,想撤销commit,可以根据实际情况,使用以下参数 ...
- js-事件1
本课我将讲述js中的事件及一些浏览器兼容问题 本章主要从以下几个方面讲起:1.事件流 2.事件的浏览器兼容 3.鼠标,键盘事件 1. 事件流 什么叫事件流? 描述的是事件接受的顺序.这句话听起来 ...
- spark-shell操作hive
本文是在集群已经搭建好的基础上来说的,还没有搭建好集群的小伙伴还请自行百度! 启动spark-shell之前要先启动hive metastore 和 hiveservice2 hive --servi ...
- file size php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- ReadIniTest_GetPrivateProfileString
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.R ...
- Template Function
// TemplateFunction.cpp : Defines the entry point for the console application. // #include "std ...
- sleep、yield、wait、join的区别(阿里)
只有runnable到running时才会占用cpu时间片,其他都会出让cpu时间片.线程的资源有不少,但应该包含CPU资源和锁资源这两类.sleep(long mills):让出CPU资源,但是不会 ...
- What Is React?--MVC
React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It ...
- MySQL binlog2sql实现MySQL误操作的恢复
对于MySQL数据库中的误操作删除数据的恢复问题,可以使用基于MySQL中binlog做到类似于闪回或者生成反向操作的SQL语句来实现,是MySQL中一个非常实用的功能.原理不难理解,基于MySQL的 ...