我有一个关于Luracast Restler v2的问题。Luracast Restler Multiformat XML not returned
我创建了我的index.php,内容如下:
require_once 'framework/restler.php';
spl_autoload_register('spl_autoload');
$r = new Restler();
$r->setSupportedFormats('JsonFormat', 'XmlFormat');
$r->addAPIClass('PROCESSOR');
$r->handle();
现在我有了下面的代码示例processor.php - 这仅仅是一个代码库的一小部分! :
class PROCESSOR {
private $api_ver = '0.1';
private $allowed = array('xxx.xxx.xxx.xxx');
public function index($request_data) {
if(empty($request_data)) throw new RestException(400,"parameter missing");
$this->checkHost();
$this->get_vars = $request_data;
$result = new stdClass();
$result->version = $this->api_ver;
$result->timestamp = date(DATE_RFC822);
$result->generated = $totaltime.' sec.';
$result->type = 'success';
$result->filesize = $this->res_filesize;
$result->url = $this->res_saved;
return $result;
}
}
我的问题是现在,当我请求发送到 http://api.myserver.xx/processor/?url=http://www.test.fr
的API做的事情必须做,并返回JSON字符串。
但是当我键入 http://api.myserver.xx/processor的.xml /?url=http://www.test.fr 它也返回JSON - 而不是XML?!?
这里有什么问题?
谢谢。
感谢报告,只是修复它在Restler 2.1.3 – Luracast 2012-02-22 03:58:27
不客气。我真的很喜欢Restler,我们正在使用它在即将发布的CMS称为Spike:[spikecms.com](http://www.spikecms。com) – Lutsen 2012-02-23 08:34:59
渴望了解更多关于SpikeCMS的信息,它可以成为Restler – Luracast 2012-02-23 12:46:59