PHP文件处理无法写入 [英] Php File handling unable to write
本文介绍了PHP文件处理无法写入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友...
我对php刚起步,刚从互联网开始学习.我看过一些文件处理的例子.但是,当我按照相同的步骤进行文件写入操作时,它不起作用.
读取功能是工作文件.但是写入文件不起作用.我也曾尝试使用** file_put_content **函数来编写. :(
Hello Friends...
I am very new to php just starting learning from internet. I seen some examples for file handling. But when I''m following the same procedure to **file writing** it''s not working.
The Reading function is working file. But writing to a file isn''t working. I have also tried to use **file_put_content** function to write. :(
<?php
if(isset($_POST[''submit1''])){
$fileName = "Text.txt";
$fh = fopen($fileName,"a") or die("can not open the file to write");
//Writing to a file
$newData = "Hello This is new Data";
fwrite($fh,$newData);
fclose($fh);
//Reading a file -- Working
$text = fopen("Text.txt","r") or die ("can not open the file to read");
while(!feof($text))
{
$myLine = fgets($text);
print $myLine;
}
fclose($text);
}
?>
请引导我..
谢谢
Please Guide me..
Thanks
推荐答案
_POST [''submit1'']))){
_POST[''submit1''])){
fileName ="Text.txt";
fileName = "Text.txt";
fh = fopen(
fh = fopen(
这篇关于PHP文件处理无法写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文