无法使用@fopen在php中创建目录或文件

时间:2017-09-19 12:34:13

标签: php

我正在尝试创建一个目录,但每当我尝试调用它时。什么都没发生。不知道为什么会这样,请协助。

$year = date('Y');
$month = date('m');
$date = date('d');

$randomString = substr( md5(uniqid (rand())), 0, 10);
$content = $videos;
$k = strlen($content);
$f = $website.'cdn/up3/video/'.$year.'/'.$month.'/'.$date.'/'.$productId.'-'.$randomString.'.mp4';

$hFile = @fopen($f, 'wb');
$m = @fwrite($hFile, $content, $k);
@fclose($f);

1 个答案:

答案 0 :(得分:0)

请检查您要在其中创建文件的文件夹的权限。它应该是755,如果没有使用下面的代码:

chmod("your folder path", 755);