How to use session in wordpress in plugin development -
i new write plugin ..i having testplugin.php file , ajax.php file ..
my code in testplugin.php
global $session; print_r($abc); //$abc array of data .. $session['arrayimg']=$abc; //saving data in session echo $session['arrayimg']; //displayin "array"
and ajax.php consists of following code
global $session; $abc = $session['arrayimg']; print_r ("abs== ".$abc); //displayin "abs== array"
and if use session_start();
i following error
warning: session_start() [function.session-start]: cannot send session cache limiter - headers sent
i want send array of data 1 file of plugin file ...
// on plugin or themes functions.php
function register_session(){ if( !session_id() ) session_start(); } add_action('init','register_session');
// set session
data -
$_session['arrayimg'] = $abc;
// data on ajax hooked function -
function resolve_the_ajax_request(){ if( !session_id()) session_start(); $abc = $_session['arrayimg']; }
Comments
Post a Comment