Home  >  Article  >  Backend Development  >  怎么保存数据到文档里

怎么保存数据到文档里

WBOY
WBOYOriginal
2016-06-13 13:46:101189browse

如何保存数据到文档里

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?PHP if($_POST)
{
    $value1=$_POST['radio1'];
    $value2=$_POST['radio2'];
    $value3=$_POST['radio3'];
    $value4=$_POST['radio4'];
    $value5=$_POST['radio5'];
    $value6=$_POST['radio6'];
    $value7=$_POST['radio7'];
    $value8=$_POST['radio8'];
}
?>


怎么样把$value1.....$value8保存到一个文档里。

------解决方案--------------------
ca。又开一贴。。文件操作。。
PHP code

    $contents = '';    

    $value1 = $_POST['radio1'];
    $value2 = $_POST['radio2'];
    $value3 = $_POST['radio3'];
    $value4 = $_POST['radio4'];
    $value5 = $_POST['radio5'];
    $value6 = $_POST['radio6'];
    $value7 = $_POST['radio7'];
    $value8 = $_POST['radio8'];
    
    $contents.="value1:{$value1}\t value2:{$value2} \t value3:{$value3}\t value4:{$value4}\t value5:{$value5}\t value6:{$value6}\t value1:{$value1}\t value1:{$value1}\t";
    $handle = fopen('aa.txt',"w+");
    fwrite($handle,$contents);
    fclose($handle);
    echo "文件写入成功";
<br><font color="#e78608">------解决方案--------------------</font><br>基础文件操作问题,lz还是多看看书吧..... <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn