php - require_once strange behavior. refreshes the page 4 times -


i had insert query whenever page loads. see insert query being executed 4 times on each page visit.

i tested , found require_once statement in causing this. getting file path & name in variable , following. re produce problem.

but if hardcode require_once("path/file.php") works; variable have same value when echo it.

if(!isset($_session['testt']))     $_session['testt'] = 0;  $_session['testt']++;  $va = $oreq->getincludefile();  require_once($va); // if write session before line, session increments 4 times. // after line session increment 1 times. i'm confused here. // if hardcode require statement file path & name, // session increments 1 time. why?  echo "session count: ".$_session['testt']; //outputs 4 

it seems page reloads 4 times if used require_once statement file path in variable.

edit:

function getincludefile($ssuffix='php') {     // returns client/index.php     return $this->_spart.'/'.$this->_ssect.'.'.$ssuffix; } 

please guide.


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -