Created
May 16, 2013 08:09
-
-
Save mikamboo/5590184 to your computer and use it in GitHub Desktop.
Serialisatoin & Désérialisation en PHP d'un tableau dans un fichier.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//----------------------------------------------------------- | |
// Serialisatoin & Désérialisation tableau <-> fichier | |
//----------------------------------------------------------- | |
echo "<pre>"; print_r($tab_lst_interventions); | |
$str_dateLog = date('Ymd_His'); | |
$str_cheminLog = CHEMIN_APPLI.'/logs/'.$str_dateLog; | |
$str_cheminFichier = $str_cheminLog.'/mon_fichiert.txt'; | |
$array_serialized = serialize($tab_lst_interventions); | |
file_put_contents($str_cheminFichier, print_r($array_serialized, true)); | |
$data = file_get_contents($str_cheminFichier); | |
echo "<pre> --------------------------- "; | |
echo "<pre>"; print_r(unserialize($data)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment