Jump to content

file functions


thenature4u

Recommended Posts

 

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.