douwen8424 2015-08-31 12:56
浏览 32

Restful Web Service无法从实时服务器PHP获取任何数据

I have created restful webservices in php to connect data with app. In my localhost I am getting everything but I am not getting any output in godaddy server.

<?php   
require_once("Rest.inc.php");

class API extends REST {    
    public $data = "";      
    const DB_SERVER = "localhost";
    const DB_USER = "root";
    const DB_PASSWORD = "";
    const DB = "beta01";        
    private $db = NULL; 
    public function __construct(){
        parent::__construct();              
        $this->dbConnect();                 
    }       
    private function dbConnect(){
        $this->db = mysql_connect(self::DB_SERVER,self::DB_USER,self::DB_PASSWORD);
        if($this->db)
            mysql_select_db(self::DB,$this->db);
    }       
    public function processApi(){
        $func = strtolower(trim(str_replace("/","",$_REQUEST['rquest'])));
        if((int)method_exists($this,$func) > 0)
            $this->$func();
        else
            $this->response('',404);                
    }

private function users(){   

        if($this->get_request_method() != "GET"){
            $this->response('',406);
        }
        $sql = mysql_query("SELECT * FROM users", $this->db);
        if(mysql_num_rows($sql) > 0){
            $result = array();
            while($rlt = mysql_fetch_array($sql,MYSQL_ASSOC)){
                $result[] = $rlt;
            }

            $this->response($this->json($result), 200);
        }
        $this->response('',204);    
    }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料