#27 ファイルにデータを書き込む (1)

 
is_writable( )
  is_weitable --- "書き込み可能かどうか" を判断
 
-->True / False を返す
 
$testFile = "test.dat";
$contents = "こんにちは!";

if (is_writable($testFile)) {

    // ファイルをオープンできたか?

    // 書き込めたか?

    // 終了処理

} else {
    echo "not writable!";
    exit;
}
  $testFile = "test.dat"; --- このファイルに・・・
  $contents = "こんにちは!"; --- この文字列を書き込む
 
  • データファイルが必要(test.dat)
  • データファイルのパーミッションを [666] にする

PAGE TOP

< 前へ 目次に戻る 次へ >