thenature4u Posted April 18, 2008 Share Posted April 18, 2008 i want to write the following data to a file. <? define('ABOUT US','We are the development People'); define('ABOUT US','We are the development People'); define('ABOUT US','We are the development People'); define('ABOUT US','We are the development People'); ?> i want to write the code as it is in output file. But in the output file, the code is displaying like this, <? <br>define('ABOUT US','We are the development People'); <br>define('ABOUT US','We are the development People'); <br>define('ABOUT US','We are the development People'); <br>define('ABOUT US','We are the development People'); <br>?><br> please help me Link to comment https://forums.phpfreaks.com/topic/101699-file-functions/ Share on other sites More sharing options...
thenature4u Posted April 18, 2008 Author Share Posted April 18, 2008 <br /> is adding to the every line. please help me. Link to comment https://forums.phpfreaks.com/topic/101699-file-functions/#findComment-520278 Share on other sites More sharing options...
haku Posted April 18, 2008 Share Posted April 18, 2008 We can't help you with your code if you don't show us your code. Link to comment https://forums.phpfreaks.com/topic/101699-file-functions/#findComment-520305 Share on other sites More sharing options...
thenature4u Posted April 18, 2008 Author Share Posted April 18, 2008 meta_tag.php <? define('ABOUT US','We are the development People'); define('ABOUT US','We are the development People'); define('ABOUT US','We are the development People'); define('ABOUT US','We are the development People'); ?> test.php <?php $FileName = "meta_tag.php"; $handle = fopen($FileName, 'r+') or die("Can't open file"); while (!feof($handle)) { $buffer = fgets($handle, 4096); $buffer = htmlspecialchars( $buffer ); $msg.= $buffer."<br>"; } fclose($handle); $myFile = "update_test.php"; $msg = html_entity_decode( $msg, ENT_QUOTES, "utf-8" ); $fh = fopen($myFile, 'w') or die("can't open file"); fputs( $fh, $msg ); fclose( $fh ); ?> the output in update_test.php should be same as meta_tag.php Link to comment https://forums.phpfreaks.com/topic/101699-file-functions/#findComment-520321 Share on other sites More sharing options...
haku Posted April 18, 2008 Share Posted April 18, 2008 Im guessing its because you are encoding the html entities, then decoding them. Somewhere in that process its adding an extra return on each line. Link to comment https://forums.phpfreaks.com/topic/101699-file-functions/#findComment-520334 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.