배열 값을 가져 오려고합니다. 이 내 배열 값입니다PHP를 사용하여 배열 값을 검색하는 방법
overlay.txt :
{"title":"sss","description":"sss","code":"sss"}
{"title":"trtr","description":"trtr","code":"tyrytr"}
{"title":"ret54","description":"56tr","code":"ty76"}
{"title":"rgfdg","description":"dfgdfg","code":"dfgdfg"}
{"title":"asfafdsf","description":"sdfsdf","code":"sdfsdfsdf"}
이 내 코드입니다 :하지만이 working.why되지 않는 이유는 무엇입니까? overlay.txt 파일에서 값을 검색하는 방법. 나는 모든 칭호를 얻지 못했습니다. overlay.txt에서 제목 값을 얻는 방법을 모르겠습니다. $ 제목이 비어 있습니다. 여기서 $ title 값을 얻기 위해 코드를 변경하고 싶습니다. 어떤 시점에서 당신이 그것을 다시 PHP 배열로 디코드 필요하므로
$info = array();
$folder_name = $this->input->post('folder_name');
$info['title'] = $this->input->post('title');
$info['description'] = $this->input->post('description');
$info['code'] = $this->input->post('code');
$json = json_encode($info);
$file = "./videos/overlay.txt";
$fd = fopen($file, "a"); // a for append, append text to file
fwrite($fd, $json);
fclose($fd);
$filecon = file_get_contents('./videos/overlay.txt', true);
$this->load->view('includes/overlays',$filecon);
//overlays page;
foreach($filecon as $files)
{
$title=$files['title'];
echo $title;
}
"이 기능이 작동하지 않음"에 대해 좀 더 구체적으로 설명해야합니다. –
나는 당신이 섞는 것 같아요. 귀하의 json 콘텐츠는 아약스에 의해 PHP로 전송됩니까? "not working"은'$ json'이 null이라는 것을 의미합니까? –
overlay.txt file.Send me PHP 코드에서 값을 다시 얻으려면 ok.how. –