با سلام.
امروز داشتم کار با فایل رو یاد می گرفتم که به مشکل بر خوردم.
وقتی که فایل را در c:/ ایجاد می کنم و بعدش میرم نگاه می کنم میبینم نیستش.
این کد ایجاد فایل:
[PHP]$newfile=fopen("c:/newfile.txt","w+") or die("fail");
if($newfile)
echo "the file has been made"."<br>";
$s=fclose($newfile);
if($s)
echo "the file has been closed successfully";[/PHP]
با کد زیر هم بهش متن اضافه می کنم:
[PHP]$adding="$_POST[ta]";
$s2=fopen("c:/newfile.txt","w+");
if($s2)
echo "the file opened correctly"."<br>";
$s=fwrite($s2,$adding) or die("the adding operation failed");
if($s)
echo "the adding text added successfully";
fclose($s2);[/PHP]
وقتی هم با کد زیر می خونمش محتویات را نشون می ده:
[PHP]$s=fopen("c:/newfile.txt","r");
if($s)
echo "the file opened for reading";
$read=fread($s,filesize("c:/newfile.txt"));
echo "you can see cantains:<br>$read";
[/PHP]
پس چرا فایل تو اون مسیر نیست؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟؟
ممنون
