운이별로없는 다른 웹 서버에서 호스팅되는 ini 파일을 구문 분석하려고합니다. 로컬에서 테스트하는 ini 파일이 있으면 구문 분석 할 수 있지만 원격 서버에 연결하려고하면 해당 행운은 없습니다.웹 페이지에서 parse_ini_file하는 방법
다음은 내가 밤새도록 작업 한 코드입니다.
<?php
$datas = parse_ini_file(http://example.com/test.ini, true);
?>
<table border="1" cellspacing="0" cellpadding="5">
<tbody>
<?php
foreach($datas as $data) {
?>
<tr>
<td rowspan="2"><?php echo htmlspecialchars($data["name"]); ?></td>
<td>Name</td>
<td>Points</td>
</tr>
<tr>
<td><?php echo htmlspecialchars($data["Name"]); ?></td>
<td><?php echo htmlspecialchars($data["Points"]); ?></td>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
Google 드라이브의 공개 공유에서 파일을 가져 오려고합니다. 이것이 내가 얻는 것입니다. 구문 분석 오류 : 예상치 못한 'https://doc-0s-c8-docs.google'(T_ENCAPSED_AND_WHITESPACE), 2 행의 /home/example/public_html/test/points.html에 ')'이 있습니다. 어떤 아이디어? –
이것은 작동합니다. 로컬에서 테스트되었습니다. 이와 같은 오류가 발생하면'.ini' 파일 구문 자체에있을 가능성이 큽니다. – JakeGould
당신 말이 맞아요. 나는 공용 폴더에 dropbox를 시도했고, 경첩없이 작동했습니다! 당신은 대단합니다! 정말 고마워! –