0
我很困難如何顯示或顯示具有多個關係的表,並返回其表/用戶關係inteadt。使用codeigniter返回REST API請求中的表和關係結果
Forexample:
我有公開表和版本表..related到1公開可以有多個/衆問題。 ,當我想加載例如
我想看到的代碼點火出版以及所有相關的問題。這是我在我的控制器代碼..
function publications_get(){
$this->output->enable_profiler(TRUE);
$this->db->select();
$this->db->from('publication');
$return = $this->db->get();
if($return!= null) {
$this->response($return->result_array(),200); //success
} else {
$this->response(NULL,404);
}
伸出來是這樣的:
<officer id="1">
<name>James T. Kirk</name>
<rank>Captain</rank>
<subordinates>
<link ref="http://ncc1701/api/officers/2">
<link ref="http://ncc1701/api/officers/3">
</subordinates>
</officer>