setcookie issue
I'm attempting to set a cookie but the behavior isn't what I'm expecting. I'm thinking that a cookie is much like a session in that the array value will be made immediately available. In the case of this 开发者_JAVA百科cookie that I've set, the value isn't available immediately and I need to refresh my browser one time to get the value. Is this right?
Yes, that's right.
When you set the cookie, you're sending it to the client. It's not available in the $_COOKIE array until the client sends it back to the server -- in other words not until the next page load.
精彩评论