我一直在尝试将输入联系人保存为文件夹中的文件,但我不知道如何使用php进行此操作。
<php
if(isset($_POST['s'])){
$neexe = $_POST['nameextention'];
$filecont = $_POST['fileBody'];
$folderpath = 'Files';
// I wan to save this as page.php with the body content inside so users can download it
}
?>
<form method="post">
<input type="text" name="nameextention" value="page.php"/>
<textarea name="fileBody"><?php if(isset($_HELP['please'])){echo 'i really need to get this done!!';}?></textarea>
<input type="submit" name="s" value="Save">
</form>
答案 0 :(得分:0)
易。使用 fopen 内置函数,如下所示:
$myfile = fopen($neexe, "w") or die("Failed to open file!");
fwrite($myfile, $filecont);
fclose($myfile);