request->session()->id().'.png'; $cakephpPath = str_replace('webroot/index.php', '', $_SERVER['SCRIPT_FILENAME']); $qrCodePath = $cakephpPath . 'webroot/img/qrcodes/' . $fileName; $this->request->session()->write('filename', $fileName); $this->request->session()->write('qrCodePath', $qrCodePath); if($message == null) { return \PHPQRCode\QRcode::png($this->request->session()->read('qrUrl'), $qrCodePath); } else { return \PHPQRCode\QRcode::png($message, $qrCodePath); } } }