无法写入文件

I would net your help concerning an issue I'm currently having with PHP

Here is the Code:

<?php

$ics_file   = 'schedule.ics';

if (is_writable($ics_file)) {
    if (!$handle = fopen($ics_file, 'w')) {
        echo "Cannot open file ($ics_file)

";
        exit;
    }

    # Write $ics_contents to opened file
    if (fwrite($handle, "foobar") === FALSE) {
        echo "Cannot write to file ($ics_file)

";
        exit;
    }

    # echo "Success, wrote to <b>schedule.ics</b><br>

";
    fclose($handle);
} else {
    echo "The file <b>$ics_file</b> is not writable

";
}
?>

On my Webpage I always receive "The file schedule.ics is not writable" so it can't access the File. Could you kindly give me a hint into the right direction?

查看全部
dougai0138
dougai0138
2014/06/13 18:15
  • php
  • filesystems
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复