2

I'm developing a site on local server, so the url of the site is http:/goodies/, there is no domain ending like ".com"

How can I make this code work?

setcookie('user', $user_check, time() + (86400 * 3), '/', 'goodies'); 
2
  • 2
    The $path and $domain arguments are optional. You can leave them out. Commented Jun 17, 2012 at 8:46
  • Ah, thanks mate. Manual says "[, string $domain [, bool $secure = false [, bool $httponly = false ]]]" without default value, so I thought it should be given. Commented Jun 17, 2012 at 8:49

1 Answer 1

3

Just don't pass $domain argument. It is not required http://php.net/manual/function.setcookie.php

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.