php - Variable only available after echo -
i perplexed @ experiencing tonight. have spent hour trying debug have gone nowhere. hope overlooking simple....
the problem getting id , storing variable ($event), starting our session , loading $event session array. happening if not echo text browser window, variable doesn't set in session. if echo browser, variable referenced correctly. have done var_dump on $event , correctly being stored string of length x x length of id.
here relevant code:
$event = $this->event_model->get_event_id_with_form_id($batch->event_id); // call returns "100" session_start(); $_session['ckfinder'] = array (); $_session['ckfinder']['enabled'] = true; $_session['ckfinder']['uploadurl'] = '/assets/event_uploads/' . $event . '/'; echo $_session['ckfinder']['uploadurl']; // returns "/assets/event_uploads//"
however, var_dump($event) returns string(3) "100" know $event exists.
weirder still if explicitly set $event '100', echo call returns "/assets/event_uploads/100/".
and weirder still if keep above code (with call $this->event_model), add echo after session_start (ie echo 'a';), again echo call return correct path.
it not clear me why happening. have never experienced issue php, though again, may being caused lack of sleep.
try call
session_write_close()
after set variables.
Comments
Post a Comment