D
D
Dmitry2016-07-04 00:43:31
PHP
Dmitry, 2016-07-04 00:43:31

Why is the code behaving so strangely?

This code does not write cookies:

$time = $time; // int количество дней
setcookie("username", 'admin', time() + $time * 86400, '/admin/');

If you remove the time variable and explicitly replace it with an integer, then cookies will be written. What is the problem? Why does it work this way?
PHP 5.6
setcookie("username", 'admin', time() + 20 * 86400, '/admin/');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2016-07-04
@another_dream

before calling setcookie() we write
and see what is really in it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question