2012-09-25 6 views
-1

폴더 디렉토리 이름 "code"를 만들려고했으며 "status.txt"에 저장하려고합니다.예기치 않은 T_CONSTANT_ENCAPSED_STRING 수신, 디렉토리 생성

예기치 않은 T_CONSTANT_ENCAPSED_STRING이 (가) 수신 된 코드 문제입니다.

if(is_writeable($newdir . "/status.txt")) { 
    if (fwrite($statusTxt, $statusCode . "," . $status . "," . $share . "," . $date . "," . $permission "\n")){ 
} 

이 방법으로 디렉토리를 생성하여 status.txt에 저장합니까? 다음은 나머지 코드입니다.

감사합니다. 도움을 주셔서 감사합니다.

$newdir = "../../data/code"; 
umask(0007); 
if(!file_exists($newdir)) 
{ 
    mkdir($newdir, 02770); 
$statusTxt = fopen($newdir. "/status.txt", "a"); 
} 
if(is_writeable($newdir . "/status.txt")) { 
    if (fwrite($statusTxt, $statusCode . "," . $status . "," . $share . "," . $date . "," . $permission "\n")){ 
} 
    echo "<p>Your form has succesfully been submit!</p>"; 
} 
fclose($statusTxt); 
} 
+0

fwrite 호출에서 마지막'\ n '앞에'.'가 없습니다. – andrewsi

답변

0
은 당신의 코드를 변경

.

+0

감사합니다.이 작은 실수는 성가신 일입니다. 다시 한번 감사드립니다. –

0

귀하의 마지막 연결은 "\n"를 들어, 이전 .이 없습니다. 오류는 기본적으로 예상치 못한 문자열이 있음을 의미합니다. 당신이 일정 PHP_EOL 위해 밖으로 \n를 교환 할 수 있습니다, 또한

if(is_writeable($newdir . "/status.txt")) { 
    if (fwrite($statusTxt, $statusCode . 
      "," . $status . "," . $share . "," . 
      $date . "," . $permission . "\n")) 
            ^^^^^^ 
... 

:

+0

고마워요,이 작은 실수는 성가신 일입니다. –

관련 문제