In mannual,it says:
creating new entries in the $_SESSION array will automatically
register them as session variables, as if you called
session_register().
If you are using $HTTP_SESSION_VARS/$_SESSION, do not use
session_register(), session_is_registered() and session_unregister()
unless you
?php
add a session_start() here
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
}
else {
$_SESSION['count']++;
}
echo $count;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
it works.
?php
session_start();
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 1;
}
else {
$_SESSION['count']++;
}
echo $count;
?
but the first time,i also get the warning(Warning: Undefined variable:
count in C:\WebShare\wwwroot\netk\5\test.php on line 9
).then ,it outputs
3 matches
Mail list logo