【问题标题】:Help with my php save to txt file?帮助我的 php 保存到 txt 文件?
【发布时间】:2011-04-04 02:35:06
【问题描述】:

我不能让这个脚本工作!我还需要这样做,以便 onload 用户将在 textarea 中。请帮忙?

<?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>

【问题讨论】:

    标签: php file save


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-04
      相关资源
      最近更新 更多