QrCodesController.php 494 Bytes
<?php
namespace App\Controller;

use App\Controller\AppController;
use QRcode;

class QrCodesController extends AppController
{
	
	public function creer($message) {
		
			$fileName = $this->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);
			return QRcode::png($message, $qrCodePath);
	}
	
}