POST
변수의 내용을 표시하려고하지만 출력이 비어 있습니다. display contenute POST
<?php
$dir = '/var/www/devData/test';
// create new directory with 777 permissions if it does not exist yet
// owner will be the user/group the PHP script is run under
if (!file_exists($dir)) {
mkdir ($dir, 0777);
}
$stringData = print_r($_POST['data'], true);
$file = "/var/www/devData/test/ciao.txt";
$fh = fopen($file, 'a+') or die("can't open file");
$fla = 0;
$arr = array();
$i = 0;
while(!feof($fh)) {
$theData = fgets($fh, filesize($file));
array_push($arr,$theData);
//echo $arr[$i];
$i++;
}
echo $stringData;
fclose($fh);
?>
I 함수를 호출 fwrite
$stringData
파일에 저장된다.
이
은 PHP 파일을 호출하는 기능이다options_label
배열이다
$.post("JS/foo.php", {data: options_label}, function(result){alert(options_label) }, "json");
.
decode_json
등을 사용해 보았지만 $stringData
은 여전히 비어 있습니다.
무엇을 표시 하시겠습니까? – Don
변수 $ stringData의 내용 – Edivad
하지만 그게 내가 물었던 이유입니다 ... "contenute"가 무슨 뜻입니까? – Don