开发者 | ericmann |
---|---|
更新时间 | 2019年3月31日 11:37 |
捐献地址: | 去捐款 |
PHP版本: | 7.1 及以上 |
WordPress版本: | 5.1.1 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
$_SESSION
functionality to WordPress, leveraging the database where needed to power multi-server installations.
Every visitor, logged in or not, will be issued a session. Session data will be stored in the WordPress database by default
to deal with load balancing issues if multiple application servers are being used. In addition, the session collection will
also be stored in memory for rapid use within WordPress.
Session data stored in the database can be encrypted at rest for better security.
/wp-session-manager
folder to the /wp-content/plugins/
directory.$_SESSION
in your code.Merely use the superglobal $_SESSION
array:
$_SESSION['user_name'] = 'User Name'; // A string $_SESSION['user_contact'] = array( 'email' => 'user@name.com' ); // An array $_SESSION['user_obj'] = new WP_User( 1 ); // An object
This depends on your PHP installation's configuration. Please read the PHP manual for more details on configuration.
Absolutely! As of version 2.0, this plugin will create a new table for WordPress to store session data. In general, this is more efficient long-term than using options for data storage. However, if your system does not allow creating a table, add the following to wp-config.php
to use the options table instead:
define( 'WP_SESSION_USE_OPTIONS', true );
PHP 5.6 was designated end-of-life and stopped receiving security patches in December 2018. PHP 7.0 was also marked end-of-life in December 2018. The minimum version of PHP supported by WP Session Manager is now PHP 7.1. If your server is running an older version of PHP, the session system will not work! To avoid triggering a PHP error, the plugin will instead output this notice to upgrade and disable itself silently. You won't see a PHP error, but you also won't get session support. Reach out to your hosting provider or system administrator to upgrade your server.
WP Session Manager overrides PHP's default session implementation with its own custom handler. Unfortunately, we can't swap in a new handler if a session is already active. This plugin hooks into the plugins_loaded
hook to set things up as early as possible, but if you have code in another plugin (or your theme) that attempts to invoke session_start()
before WP Session Manager loads, then the custom handler won't work at all.
Inspect your other plugins and try to find the one that's interfering. Then, reach out to the developer to explain the conflict and see if they have a fix.
function_exists()
checks to avoid conflicts with other systems.$wpdb
global is not yet set when a session is deleted from the database.wp_install
hook to create custom table immediately.WP_Session
object.WP_SESSION_ENC_KEY
is setsetcookie
parameters