0
joomla '_content'테이블을 변환하는 동안 올바른 출력이 나오지 않습니다. 내 PHP 코드 :joomla 테이블을 json PHP로 변환하는 방법
<?php
$hostname = "hostname";
$username = "myusername";
$dbname = "mydatabase";
$password = "mypassword";
mysql_connect($hostname, $username, $password) OR DIE ("Unable to
connect to database! Please try again later.");
mysql_select_db($dbname);
$sql=mysql_query("SELECT `title`, `fulltext` FROM `jos_content` WHERE `catid`=8");
while($row=mysql_fetch_assoc($sql)){
$output[]=$row;
}
print(json_encode($output));
mysql_close();
?>
출력은 json 파일이지만 'fulltext'행에 대한 데이터는 표시하지 않습니다. 출력 샘플 :
[{"title":"Tu Jaane Na - Ajab Prem Ki Ghazab Kahani (Chords)","fulltext":""},
{"title":"Aahatein - Agnee (Chords)","fulltext":""}]
전체 텍스트에서 값을 검색하지 않습니다. 제발 도와주세요.
당신은 최고입니다. 기사에 더 많은 내용이 없습니다. 나는 전체 텍스트를 introtext로 바꿨다. 그러나 '/ strong'태그가있는 곳에서는 '\/strong'을 표시합니다. 생성 된 json 파일의 유효성을 검사 할 수 없습니다. –
'json_encode'가 자동으로 이스케이프 처리합니다. [docs] (http://php.net/manual/en/function.json-encode.php)를 체크하면 PHP 5.4 이상일 경우 자동'/'이스케이프를 제거하는 옵션을 추가 할 수 있습니다. 예를 들어'json_encode ($ output, JSON_UNESCAPED_SLASHES); ' –
고마워, 내가 php5.0있다. 내 json 파일에 대한 링크 : http://www.guitarmaddy.com/guitarmaddyapp/createhindichords.php. json 파일의 유효성을 검사하지 않습니다. 나는 초보자입니다. 이 파일의 유효성을 검사하려면 어떻게해야합니까? –