2011-12-06 18 views
5

私はPHPで私のWebサイトのログファイルを作成する方法を知りたいですか?これは、各ユーザーが訪問したページに関するデータを維持するのに役立ちます&私のウェブサイトで行ったすべてのアクション。だからどんな仲間が私を助けることができますか?私のWebサイトのログファイルをPHPで作成するには?

ありがとう、

+0

ログに登録する必要があるものはありますか? –

+0

保存したい情報はありますか?各ユーザーが訪問したページ、一般的な操作...もっと明確にしてください! –

答えて

25
$file = 'people.log'; 
// The new person to add to the file 
$person = "John Smith\n"; 
// Write the contents to the file, 
// using the FILE_APPEND flag to append the content to the end of the file 
// and the LOCK_EX flag to prevent anyone else writing to the file at the same time 
file_put_contents($file, $person, FILE_APPEND | LOCK_EX); 

file_put_contents()のマニュアルページを参照してください。

+1

この回答をお寄せいただきありがとうございます。私はダウンボートを削除しました。 – Treffynnon

関連する問題