2013-05-06 47 views
-2

我想知道Joomla 3支持JSON格式,如何以json格式獲取輸出,就像我們輕鬆獲取XML格式的數據一樣。如果可能的話,請回復。我會非常感謝你們。如何獲取joomla中的JSON 3

回答

0
$document = JFactory::getDocument(); 

// Set the MIME type for JSON output. 
$document->setMimeEncoding('application/json'); 

// Output the JSON data. 
echo json_encode($data); 
1

如果您查看/安裝文件夾中的代碼,它將使用AJAX請求(以及固有的JSON字符串)來運行。這應該會幫助你一些。