| [php]écrire dans un fichier, retour à la lign par Flobard |
jeudi 26 mai 2005 à 19:23:43 |
$fichier = fopen('pass.php','w+');
fputs($fichier,'<?PHP\n$');
fputs($fichier,'bonlogin = \''.$modiflogin.'\';\n$');
fputs($fichier,'bonpass = \''.$modifpass.'\';\n');
fputs($fichier,'?>');
fclose($fichier);
<?PHP $bonlogin = $modiflogin; $bonpass = $modifpass; ?>
Salut,
Et comme ça? fputs($fichier, "bonlogin = '$modiflogin';\n bonpass = '$modifpass';\n ?>"; |
Salut à tous,
Il y à aussi la séquence d'échappement: \r\n Qui est à placer tout de suite après la variable comprise entre les " " Ex: <?php
$bonlogin = "root";
$bonpass = "pass";
$modiflogin = "ancien_login";
$modifpass = "ancien_pass";
/*
J'ai déclaré ces 4 variables ici afin d'éviter une erreur,
mais normalement elles arrivent du champ de formulaire,
donc à supprimer ensuite dans ce script !
*/
$fichier = fopen('pass.php','w+');
fputs($fichier,"<?PHP\r\n");
fputs($fichier,"$bonlogin = '$modiflogin';\r\n");
fputs($fichier,"$bonpass = '$modifpass';\r\n");
fputs($fichier,"?>");
fclose($fichier);
?>
Et voilou pour le retour chariot..., à savoir que ce script exécuté donneras: <?PHP root = 'ancien_login'; pass = 'ancien_pass'; ?> C'est peut-être pas ce que tu voulais que ça donne, non ? bye@+ PS: pourrais-tu mettres le script en entier, svp? "La culture, c'est comme la confiture... Moins on n'en as, plus on l'étale...!" ;-) |
| 20/06 21h40 | [PHP] écrire fichier txt en choissant ligne | Programmation | 23/03 18h46 | 9 |
| 29/05 11h30 | pb ecriture fichier php | Programmation | 29/05 16h10 | 4 |
| 12/03 11h24 | PHP (mail : retours ligne corps du sujet) | Programmation | 12/03 11h49 | 2 |
| 12/10 19h52 | [PHP]Probleme de retour a la ligne | Webmastering | 16/10 22h20 | 7 |