PHP 코드에서 XML 파일을 만드는 데 도움이 필요합니다. 내가 원하는대로 XML을 형성하는 함수를 만들었지 만, 파일에 형성된 XML을 저장하는 방법을 모른다.PHP에서 xml 파일을 만들 때 문제가 발생했습니다
또한 다음 번에 이미 작성한 xml 파일을 업데이트 할 수있는 방법을 알려줄 수도 있습니다.
내 코드는 다음과 같습니다
이public function create_xml()
{
$output = "<?xml version=\"1.0\" encoding=\"utf-8\" ?> ";
$output .= "<data>";
$output .= "<news>";
$news_articles = new C7_News();
$db = C7_Bootstrap::getDb();
$foxsport_sql = "SELECT headline, link FROM c7_news
WHERE source = 'foxsports' AND category = 'Breaking News'
LIMIT 0,4";
$foxsport_rowset = $db->fetchAll($foxsport_sql);
$data = array();
foreach($foxsport_rowset as $foxsport_row)
{
$output .= "<title>";
$output .= "<description>";
$output .= "<![CDATA[";
$output .= $foxsport_row['headline'];
$output .= "]]>";
$output .= "<link>";
$output .= $foxsport_row['link'];
$output .= "</link>";
$output .= "</title>";
}
$output .= "</news>";
$output .= "</data>";
}
내가 잘못 너무 일을 할 수
, PLZ 나 XML을 만들 수있는 가장 좋은 방법을 알려주세요.
는 Zeeshan