繁体   English   中英

帮助我的PHP保存到TXT文件?

[英]Help with my php save to txt file?

好吧,我不能让这个脚本工作! 我还需要做到这一点,以便用户在加载时将其放在文本区域中。 请帮忙?

<?php
  //the path to any file
  $fn = "test.txt";

  if (isset($_POST['content'])) {
      $content = stripslashes($_POST['content']);
      $fp = fopen($fn, "w") or die("Error opening file in write mode!");
      fputs($fp, $content);
      fclose($fp) or die("Error closing file!");
  }
?> 


<form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post">
        <textarea style="font-family: Marker Felt; font-size: 16px; background-color: transparent; border: none; height:159px; resize: none;" id="myDiv"><?php readfile($fn); ?></textarea>
        <br/><br/><br/><br/><br/>
        <br/><br/><br/><br/><br/>
        <br/>
        <input type="submit" value="Save">  
</form>

<textarea ...在您的情况下缺少名称属性,它将是name="content"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM