function getCode() { session_start(); $validationCode = new ValidationCode(60, 28, 4); $_SESSION['validationCode'] = $validationCode->getCheckCode(); $validationCode->showImage(); }
<?php session_start(); require_once 'ValidationCode.php'; $image = new ValidationCode(); $image->showImage(); $_SESSION['validationcode'] = $image->getCheckCode();