Php 从Url参数中获取一个值,并将其保存在txt文件中
我想从url参数保存一个值 输入到服务器上的txt文件中 $id=$_GET['id'];Php 从Url参数中获取一个值,并将其保存在txt文件中,php,Php,我想从url参数保存一个值 输入到服务器上的txt文件中 $id=$_GET['id']; 我得到的价值不知道如何保存在一个Txt文件 您只需打开一个文件并写入内容: $fd = fopen("FILENAME","w"); fwrite($fd, $id); fclose($fd); 查看PHP手册:您可以这样使用 $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $string
我得到的价值不知道如何保存在一个Txt文件 您只需打开一个文件并写入内容:
$fd = fopen("FILENAME","w");
fwrite($fd, $id);
fclose($fd);
查看PHP手册:您可以这样使用
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $id;
fwrite($fh, $stringData);
fclose($fh);
好的,您必须打开一个文件:
$datei_handle=fopen("part_of_url.txt",w);
确保使用正确的模式!
写下你的东西
fwrite($datei_handle,$your_url_part);
关闭文件
fclose($datei_handle);
同时检查手册。我想这是很好的解释。
希望这能有所帮助
fclose($datei_handle);