简体   繁体   中英

Laravel setcookie() expects parameter 3 to be integer, float given

I'm using Laravel 5.2, and I'm getting this error on first page. What is this error and how should I solve it?

ErrorException in Response.php line 348:
setcookie() expects parameter 3 to be integer, float given
in Response.php line 348
at HandleExceptions->handleError('2', 'setcookie() expects parameter 3 to be integer, float given', '/var/www/dev/vendor/symfony/http-foundation/Response.php', '348', array('this' => object(Response), 'values' => array('Sat, 07 Oct 2017 08:31:17 GMT'), 'name' => 'Date', 'value' => 'Sat, 07 Oct 2017 08:31:17 GMT', 'cookie' => object(Cookie)))
at setcookie('XSRF-TOKEN', 'eyJpdiI6InVMSlFsWGl3VzBcL3J5TEh6K3JZYU5BPT0iLCJ2YWx1ZSI6IlRnbitTUWNOWGNaZjE5MlJoVk1iWHJlQmR6U0xjMmNQME9BWDRoNDN2Q2NqWStoK3grQ2l4NGRnMXBZdHJ2b0NNVXZZdElvRXE3OWhvcVhiVGx5b3NBPT0iLCJtYWMiOiJkYmU3MDUyMzZkMTk4NTcwYmE1MTA0NWY0Njk5MDhkNzhlZDlmNTMzZjRjOGNkNGZhNmFmODk5ZWZkOGE2NWJmIn0=', '130356383897', '/', null, false, false) in Response.php line 348
at Response->sendHeaders() in Response.php line 373
at Response->send() in index.php line 56

The third parameter must be int .

Just convert the third parameter to int :

setcookie($name, $value, (int)$expire)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM