简单的PHP问题

OK, so here's the snippet:

                // start rememberMe
    $cookie_name = 'db_auth';

    $cookie_time = (3600 * 24 * 30); // 30 days

    // check to see if user checked box
    if ($remember == 1) {
setcookie ($cookie_name, 'username='.$username., time() + $cookie_time);
    } 

For some reason it breaks and I can't see why. It is part of a larger function which works fine when I comment this snippet out. Any ideas?

You have an extra dot after "$username" in the second last line.

try putting parentheses around your arguments for setcookie?

like this:

setcookie ($cookie_name, ('username='.$username), (time() + $cookie_time));

untested, but maybe the plus sign is causing your issue?

This is also assuming that the rest of your code is ok. Usually php throws errors, so if you're getting a blank page, the first place I would look is your page source.