phpfopen related issues
phpfopen related issues
php fopen problem helptempletest.php PHP code <?php $title = "tst"; $file = "hehe"; $fp = fopen ("temp.html","r"); $cOntent= fread ($fp,filesize ("temp.html")); // echo "Read information".$content."”; $content .= str_replace (“{file}”,$file,$content); // echo $content; $content .= str_replace (“{title}”,$title,$content); $filename = “test.html”; $handle = fopen ($filename,”w”); //Open the file pointer and create the file /* Check if the file is created and writable */ if (!is_writable ($filename)){ die (“File: “.$filename.” is not writable, please check its properties and try again!”); } if (!fwrite ($handle,$content)){ //Write information to file die (“Generate file”.$filename.”Failed!”); } fclose ($handle); //Close the pointer die (“Create file”.$filename.”Success!”); ?> temp.html PHP code {file} The generated interfacetest.html HTML code {file} hehe {file} hehe Try to make the article staticQ: Why does it appear so many times? I only need the last time. . ——Solution——————– $cOntent= str_replace (“{file}”,$file,$content);// echo $content;$cOntent= str_replace (“{title}”,$title,$content); No., otherwise the results before and after processing will be connected
phpfopen related issues
Help with php fopen problemstempletest.php PHP code http://www.CodeHighlighter.com/–><?php $title = "tst"; $file = "hehe"; $fp = fopen ("temp.html","r"); $cOntent= fread ($fp,filesize ("temp.html")); // echo "Read information" .$content."”; $content .= str_replace (“{file}”,$file,$content); // echo $content; $content .= str_replace (“{title}”,$title, $content); $filename = “test.html”; $handle = fopen ($filename,”w”); //Open the file pointer and create the file/* Check whether the file is created and writable*/ if (!is_writable ($filename)){ die (“File: “.$filename.” cannot be written, please check its properties and try again!”); } if (!fwrite ($handle,$content)){ //Write the information Enter the file die (“Generate file”.$filename.”Failed!”); } fclose ($handle); //Close the pointer die (“Create file”.$filename.”Success!”);?> temp.html PHP code http://www.CodeHighlighter.com/–> {file} The generated interfacetest.html HTML code http://www.CodeHighlighter.com/–> {file } hehe {file} hehe Try to make the article staticQ: Why does it appear so many times? I only need the last time. . ——Solution——————–$cOntent= str_replace (“{file}”,$file,$content);// echo $content;$cOntent= str_replace (“{title}”,$title,$content ); No., otherwise the results before and after processing will be connected
phpfopen related issues
php fopen problem helptempletest.php PHP code <?php $title = "tst"; $file = "hehe"; $fp = fopen ("temp.html","r"); $cOntent= fread ($fp,filesize ("temp.html")); // echo "Read information".$content."”; $content .= str_replace (“{file}”,$file,$content); // echo $content; $content .= str_replace (“{title}”,$title,$content); $filename = “test.html”; $handle = fopen ($filename,”w”); //Open the file pointer and create the file /* Check if the file is created and writable */ if (!is_writable ($filename)){ die (“File: “.$filename.” is not writable, please check its properties and try again!”); } if (!fwrite ($handle,$content)){ //Write information to file die (“Generate file”.$filename.”Failed!”); } fclose ($handle); //Close the pointer die (“Create file”.$filename.”Success!”); ?> temp.html PHP code {file} The generated interfacetest.html HTML code {file} hehe {file} hehe Try to make the article staticQ: Why does it appear so many times? I only need the last time. . ——Solution——————– $cOntent= str_replace (“{file}”,$file,$content);// echo $content;$cOntent= str_replace (“{title}”,$title,$content); No., otherwise the results before and after processing will be connected