PHP5: Stocker une classe dans une session

Author:

 session
Download

<?php
  session_start();

  class ClasseSession
  {
    protected $Nom;

    public function setNom ($nouveauNom){
      $this->Nom = $nouveauNom;
    }

    public function getNom ()
    {
      return $this->Nom;
    }
  }

  $_SESSION['Valeur_ClasseSession'] = new ClasseSession ();

  function AfficherSession ()
  {
    $_SESSION['Valeur_ClasseSession']->setNom ("Steven Cook");
    echo $_SESSION['Valeur_ClasseSession']->getNom ();
  }
  AfficherSession();
?>

Leave a Reply

Your email address will not be published. Required fields are marked *


four + = 12