1
사이트에서 필자가 설치하지 않았기 때문에 설치시/public_html/libraries/joomla/document/json을 추가했습니다. 사이트가 1.5에서 실행되고 로컬로 Joomla 2.5를 사용하고 있습니다./libraries/joomla/document/json 아래의 jDocument 클래스가 무시되었습니다.
내 URL은 &format=json
이 추가되었지만 응답 헤더는 text/html입니다. 아마 2.5의 파일이 1.5와 호환되지 않을 수 있습니다.
<?php
defined('JPATH_PLATFORM') or die;
class JDocumentJSON extends JDocument
{
protected $_name = 'joomla';
public function __construct($options = array())
{
parent::__construct($options);
$this->_mime = 'application/json';
$this->_type = 'json';
}
public function render($cache = false, $params = array())
{
JResponse::allowCache(false);
JResponse::setHeader('Content-disposition', 'attachment; filename="' . $this->getName() . '.json"', true);
parent::render();
return $this->getBuffer();
}
public function getName()
{
return $this->_name;
}
public function setName($name = 'joomla')
{
$this->_name = $name;
return $this;
}
}
방금 파일을 2.5에서 가져 와서 1.5로 고정 시켰다고 하시겠습니까? 아니, 그럴 일은 없을거야. – Elin
@Elin 작동하지 않는 것을 제거해 주셔서 감사합니다. 무관 한 주제에; 1.5에 대한 API 참조를 알고 있습니까? 그것은 Joomla 사이트에있는 것 같지 않거나 꽤 잘 숨기고있어. – HMR
@Elin 발견 : http://docs.joomla.org/Framework/1.5도 삭제 된 다른 페이지로 리디렉션됩니다. 이 문서를 작성하고 번역하는 데 시간을 투자 한 모든 사람들에게 유감입니다. – HMR