-3
我有一個用PHP編寫的表單結構網頁。當提交信息時,它會提供一個唯一的ID。使用PHP的網頁響應
現在我想要在文件中使用此唯一ID。例如:
$input = "man.id: ".$id;
其中$id
是來自網頁的響應。
$input
存在於同一個PHP文件中。
我有一個用PHP編寫的表單結構網頁。當提交信息時,它會提供一個唯一的ID。使用PHP的網頁響應
現在我想要在文件中使用此唯一ID。例如:
$input = "man.id: ".$id;
其中$id
是來自網頁的響應。
$input
存在於同一個PHP文件中。
這裏有一個如何寫(追加),文本文件用PHP的例子:
$id = GetID(); // GetID can return a value stored on disk that gets incremented
$input = "man.id: " . $id;
$logfile = "mypage.log";
$file = fopen($logfile, 'a'); // Try to open the file in Append mode
if($file) // If the file was opened successfully, i.e. if $file is a valid file pointer
{
flock($file, LOCK_EX); // Exclusive lock
fwrite($file, $input);
fclose($file);
}
你提的問題是很難理解的。您是否想知道如何將該輸入行寫入文件? –
你在這裏問什麼? – Drewdin
@KileyNaro:是 –