在PHP写入字符串到TXT文件的代码方法

 

在PHP写入字符串到TXT文件的代码方法

 

  //$file:文件路径,$content要写入的字符串    
    function put_to_file($file, $content) {   
        $fopen = fopen($file, 'wb');    
        if (!$fopen) {        
            return false;    
        }    
        fwrite($fopen, $content);    
        fclose($fopen);    
        return true;
    }

 

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/114773.html<

(0)
运维的头像运维
上一篇2025-02-17 22:21
下一篇 2025-02-17 22:22

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注