Afficher un .php en .txt
Camille
-
avion-f16 Messages postés 19182 Date d'inscription Statut Contributeur Dernière intervention -
avion-f16 Messages postés 19182 Date d'inscription Statut Contributeur Dernière intervention -
Salut,
J'ai un fichier .php que je voudrais lire en .txt, voici mon script :
$fichier = file("..\article\news_02\index.php");
$total = count($fichier);
for($i = 0; $i < $total; $i++)
{
echo $fichier[$i];
}
Le problème est qu'il ne m'affiche pas le code mais le résultat du fichier...
Aidez moi !
J'ai un fichier .php que je voudrais lire en .txt, voici mon script :
$fichier = file("..\article\news_02\index.php");
$total = count($fichier);
for($i = 0; $i < $total; $i++)
{
echo $fichier[$i];
}
Le problème est qu'il ne m'affiche pas le code mais le résultat du fichier...
Aidez moi !
Configuration: Windows 7 / Firefox 3.5.8
4 réponses
-
-
Il faut dire au navigateur que c'est un fichier texte grâce aux entêtes HTTP.
Au tout début de ton script :header('Content-Type: text/plain; charset=UTF-8');(Remplace UTF-8 par l'encodage de ton fichier) -
-
Si tu ne le précises pas et que tu n'as pas de problème d'accents, alors c'est sans doute iso-8859-1