Re: Sessions
| From: | Jim Lucas | Date: | Mon, 15 Sep 2008 00:18:51 +0000 |
| Subject: | Re: Sessions | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-280142@lists.php.net to get a copy of this message | ||
Ashley Sheridan wrote:
On Sun, 2008-09-14 at 18:04 +0100, Stut wrote:There is a setting the php.ini that will allow you to enable sessions without requiring you to call session_start(). It will automagically turned on for you at the start of every script execution.On 14 Sep 2008, at 17:03, Tom Shaw wrote:Another caveat is that you must call session_start() before *any* content is sent to the browser, and this includes even a single space character.When you start a session using session_start() and start adding indexes to the session super global array a small cookie is set on the clients side that keeps track of the user, and the session index data that you create is stored only in the memory on the server side unless specified in the PHP file to store the session data in some specified directory or means db. Plus you can access and manipulate the session array just like you could any other array.By default session data is stored in files in /tmp. This can be changed in php.ini. You can also completely override the session management system allowing you to store the data anywhere you want. For example: http://stut.net/blog/2008/07/20/mysql-sessions/ You can indeed access and manipulate the session array just like any other array but there's one important different. Session array keys must be valid variable names. This means that you cannot use numeric indexes, and there are a few other restrictions. For more info see the manual (http://php.net/language.variables). -Stut -- http://stut.net/
Ash www.ashleysheridan.co.uk