파일을 만들고 동적으로 내용을 쓰려고합니다. 아래는 제 코드입니다.PHP가 없으면 파일을 만듭니다.
$sites = realpath(dirname(__FILE__)).'/';
$newfile = $sites.$filnme_epub.".js";
if (file_exists($newfile)) {
$fh = fopen($newfile, 'a');
fwrite($fh, 'd');
} else {
echo "sfaf";
$fh = fopen($newfile, 'wb');
fwrite($fh, 'd');
}
fclose($fh);
chmod($newfile, 0777);
// echo (is_writable($filnme_epub.".js")) ? 'writable' : 'not writable';
echo (is_readable($filnme_epub.".js")) ? 'readable' : 'not readable';
die;
그러나 파일을 만들지 않습니다.
답변을 공유하고 도움을주십시오. 감사! 사용
나는 꽤 똑같은 문제를 안고 있었다. 나는 잘못된 이름으로 파일을 만들려고했다. <$ fname = $ Datetime-> format ('Ymd H : i : s')는 어리 석다. – erwan