php文件操作

  $myfile = fopen("vv.php", "w") or die("Unable to open file!");
$txt = stripslashes($_POST["txt"]);
fwrite($myfile, $txt);
fclose($myfile);
<?php
    $fp = fopen("lock.txt","w+");
    if (flock($fp,LOCK_EX)) {
        //获得写锁,写数据
        fwrite($fp, "write something");

        // 解除锁定
        flock($fp, LOCK_UN);
    } else {
        echo "file is locking...";
    }
    fclose($fp);
?>

评论

刷新

友情链接