05-03-2005, 07:48
|
|
|
|
חבר מתאריך: 07.07.04
הודעות: 694
|
|
הנה קוד קטן שכתבתי לך , באמצעות function_exists בודק אם ניתן להשתמש בfile_put_contents של PHP5 ואם לא משתמש בfwrite הרגיל .
קוד PHP:
<?php $newfile = "file.txt" $newcontent = "Hi, How Are you? This is a New File!"; if(function_exists("file_put_contents")){ file_put_contents($newfile,$newcontent); }else{ $fp = fopen($newfile,"w+"); fwrite($fp,$newcontent); fclose($fp); } ?>
|