Ric*_*rma 2 php api codeigniter
我买了一个用codeigniter制作的web服务的android应用程序.此Web服务中的API如下所示.
<?php
if (!defined("BASEPATH"))
    exit("No direct script access allowed");
class Site extends back {
    public function __construct() {
        parent::__construct();
        $this->lang->load("site", "english");
        $this->load->model("site_model", "site");
    }
    //=====================================================================
    public function get_updates($last_author, $last_quote) {
        $this->db->where("_auid > ", $last_author);
        $this->db->where("au_status", 1);
        $result["authors"] = $this->db->get("authors")->result_array();
        $this->db->select("quotes.*, authors._auid, authors.au_status");
        $this->db->from("quotes");
        $this->db->join("authors", "authors._auid = quotes.qu_author AND authors.au_status = 1");
        $this->db->where("_quid > ", $last_quote);
        $this->db->where("qu_status", 1);        
        $result["quotes"] = $this->db->get()->result_array();
        echo json_encode($result);
    }
    
}我正在学习php.我已经创建了另一个新的corephp Web服务.我不理解上面的api,因此无法为我的新Web服务制作类似的api.两个Web服务都使用相同的数据库......任何人都可以建议我如何在我的新corephp Web服务中使用上面的API?
对不起我的坏知识.
谢谢
这很简单
function get_updatesget 2参数作为输入
1)$ last_author // _auid(id)字段的值属于表作者
2)$ last_quote // _quid(id)字段的值属于表引号
$this->db->where("_auid > ", $last_author);
        $this->db->where("au_status", 1);
        $result["authors"] = $this->db->get("authors")->result_array();
这些行从表作者获取数据,其匹配值为$ last_author参数
第二个查询从表引号中获取数据,并与作者联接,匹配值为$ last_quote参数.
Join用于将两个或多个表粉碎到一个表中.
$ last_author和$ last_quote是从应用程序发送的请求参数.
所需结果将存储在$ result中,并以json对象作为响应数据返回给应用程序.
| 归档时间: | 
 | 
| 查看次数: | 57 次 | 
| 最近记录: |