Opera和PHP会话问题

I have a login script that works fine in IE and FireFox but in Opera I can sometimes stay login for a couple of pages and then I'm logged out or something or I can't log in at all.

Can someone explain why this might be happening and how can I fix it?

Here is my code for my sessions at the top of my header.

$title = 'page title';
ob_start(); // Start output buffering.
session_start(); // Initialize a session.

Is it possible that you have cookies disabled in Opera? If there is no cookie, the browser has no way to indicate to the server that you are supposed to be logged in to the website.

Opera and PHP don't get along when it comes to cookies on IP domains. There doesn't seem to be a reason for this, but as of the time of this writing this has been the case for something like a year (specifically the 11.* version of opera).

If you're testing locally simply switch to "localhost" (127.0.0.1 can have this issue). If you are trying to access a remote domain, you will have to access it though a domain name, otherwise cookies will fail and you will not be able to login.