QrCodesController.php 486 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/' . $fileName;
			
	
			$this->request->session()->write('filename', $fileName);
			return QRcode::png($message, $qrCodePath);
	}
	
}