fopen으로 php파일 생성 질문있습니다

2017-12-04 (월) 06:41:18 3,548

$landing_file = G5_PATH.'/event/'.$_POST['ld_table'].'.php';
 

$f = @fopen($landing_file, 'a+');
        
        fwrite($f, "<?php\n");
        fwrite($f, "include_once('./_common.php');\n");
        fwrite($f, "include_once('./inc_consultation_form.php');\n");
        fwrite($f, "?>");
        
        @fclose($f);

를 통해서 이벤트.php 파일을 생성했습니다.

그리고 생성된 파일을 수정하고 접속해봤는데 변경한 내용이 적용되지않네요 ㅠㅠ

<?php
include_once('./_common.php');
include_once('./inc_consultation_form.php');
?>

<head>
    <title>event</title>
</head>
<body>
    <h1>hello</h1>
</body>

fopen으로 만든 파일은 웹파일로 사용할수가 없나요?

|

답변 1개

chmod($landing_file, G5_FILE_PERMISSION);

쓰기 권한을 줘야 할겁니다. ^^

답변을 작성하려면 로그인이 필요합니다.