there is such a code

if ($ch4 = Yii::$app->request->get('ch4') == true) { $ch4 = Yii::$app->request->get('ch4'); } else { $ch4 = $session->get('ch4'); } $session->set('ch4', $ch4); 

where Yii::$app->request->get getting the get request, $session->get getting the values ​​from the session and writing to the session $session->set these dances with tambourines were designed so that if the client clicks on the browser back button. But now it turns out the following situation: query сh4 may be empty (the client didn’t choose it, and the previous query selected the client that ch4 = 2 and now this value was recorded in the session. Therefore, I would like to be able to get the value from the session only if the client pressed the button back on the browser. Is that possible?

  • Try using HTTP_REFERER - Urmuz Tagizade
  • @UrmuzTagizade and how even for an example? - Sergalas
  • if (isset ($ _ SERVER ["HTTP_REFERER"])) {// Here is your functional} - Urmuz Tagizade
  • Is the version with historyAPI and segments in URL unacceptable? stackoverflow.com/a/25806609/6645679 - Ninazu

0