当前位置: 首页>>代码示例>>PHP>>正文


PHP SaeMysql::closeDb方法代码示例

本文整理汇总了PHP中SaeMysql::closeDb方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql::closeDb方法的具体用法?PHP SaeMysql::closeDb怎么用?PHP SaeMysql::closeDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SaeMysql的用法示例。


在下文中一共展示了SaeMysql::closeDb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TimingTask

function TimingTask()
{
    // load urls
    $mysql = new SaeMysql();
    $sql = "SELECT url FROM `url`";
    $data = $mysql->getData( $sql );
    $mysql->closeDb();

    $queue = new SaeTaskQueue('task_queue_0_2');
    $array = array();
    for($i = 0; $i < sizeof($data); ++$i)
    {
        //$array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php", "postdata"=>"target=".$data[$i], "prior"=>true);
        $array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php?target=" . $data[$i]["url"], "postdata"=>NULL, "prior"=>true);
    }
    
    $queue->addTask($array);

    $ret = $queue->push();
    if ($ret === false)
    {
        var_dump($queue->errno(), $queue->errmsg());
        echo "Failed.";
    }
    else
    {    
        echo "Success.";
        print_r($array);
    }
}
开发者ID:0902horn,项目名称:urlwatcher-sae,代码行数:30,代码来源:cron_daily.php

示例2: syncPhone

function syncPhone($id, $oldPhone, $newPhone)
{
    $url = 'http://x.suzhoumaker.com/syncAction.php';
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, "oldPhone=" . $oldPhone . "&newPhone=" . $newPhone);
    // receive server response ...
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $server_output = curl_exec($ch);
    curl_close($ch);
    $syncAction = 3;
    // further processing ....
    $mysql = new SaeMysql();
    if ($server_output == "OK") {
        $syncAction = 0;
    }
    $sql = "UPDATE Member SET m_sync_action = " . $syncAction . ", m_updated_on=now() WHERE m_num=" . $id;
    $mysql->runSql($sql);
    if ($mysql->errno() != 0) {
        die("Error:" . $mysql->errmsg());
    } else {
        //
    }
    $mysql->closeDb();
}
开发者ID:kisunsz,项目名称:kisun,代码行数:26,代码来源:utils.php

示例3: get_bookinfo

function get_bookinfo()
{
    $mysql = new SaeMysql();
    if (!isset($_GET['campus'])) {
        $sql = "SELECT * FROM bookinfo";
        $data = $mysql->getData($sql);
        return $data;
    } else {
        $sql = "SELECT * FROM bookinfo WHERE campus = '" . $_GET['campus'] . "'";
        $data = $mysql->getData($sql);
        return $data;
    }
    $mysql->closeDb();
}
开发者ID:a707937337,项目名称:letsgo_work,代码行数:14,代码来源:test.php

示例4: check_admin

function check_admin()
{
    if (isset($_COOKIE["admin_id"]) && isset($_COOKIE["admin_username"]) && isset($_COOKIE["admin_key"])) {
        $id = intval($_COOKIE["admin_id"]);
        $mysql = new SaeMysql();
        $sql = "select * from `qs_admin` where `id`={$id}";
        $row = $mysql->getLine($sql);
        $mysql->closeDb();
        if (3 == count($row)) {
            $admin_username = $row["username"];
            $admin_key = md5($row["password"] . $admin_username);
            if ($_COOKIE["admin_key"] == $admin_key) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        return false;
    }
}
开发者ID:dalinhuang,项目名称:OEMS,代码行数:23,代码来源:common-function.php

示例5: receiveText

 private function receiveText($obj)
 {
     $keyword = trim($obj->Content);
     if (is_numeric($keyword) && $keyword >= 100 && $keyword < 200) {
         /*
         $callUri ="http://duplicall.eicp.net:8088/rs/smarttap/calls/info?maxResults=10&sortField=startTime&sortOrder=DESC&targetId=".$keyword;
         $credentials = "admin:admin";
         		
         $ch = curl_init();
         curl_setopt($ch,CURLOPT_URL,$SWXurl);
         curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
         curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
         curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
         curl_setopt($ch, CURLOPT_USERPWD, $credentials);
         curl_setopt($ch,CURLOPT_HTTPHEADER,array("Accept: application/json"));
         curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
         $output = curl_exec($ch);
         curl_close($ch);	
         */
         //$content ="您发送的是数字文本:" . $keyword;
         $smcValue = SaeMemCache_get($obj->FromUserName . "key");
         $content = $smcValue;
         $result = $this->transmitText($obj, $content);
         //if (SaeMemCache_get($obj->FromUserName."key",$obj->FromUserName."Recording");
     } else {
         switch (strtolower($keyword)) {
             case "id":
                 $access_token = get_Access_Token();
                 $result = $this->transmitText($obj, "Access_Token: " . $access_token);
                 break;
             case "61":
                 $CC = new CCInterface();
                 $CC->SendMsg($obj->FromUserName, "【DC测试】六一节快乐 ");
                 break;
             case "users":
                 $SWXurl = "http://duplicall.eicp.net:8088/rs/smarttap/users/info";
                 $credentials = "admin:admin";
                 $ch = curl_init();
                 curl_setopt($ch, CURLOPT_URL, $SWXurl);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
                 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                 curl_setopt($ch, CURLOPT_USERPWD, $credentials);
                 curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                 $output = curl_exec($ch);
                 curl_close($ch);
                 $retArray = json_decode($output, true);
                 $userArray = $retArray['usersInfo'];
                 usort($userArray, function ($a, $b) {
                     if ($a["id"] == $b["id"]) {
                         return 0;
                     }
                     return $a["id"] < $b["id"] ? -1 : 1;
                 });
                 foreach ($userArray as $user) {
                     //$content .= $user["uri"]."|".$user["id"]."|".$user["displayName"]."|".$user["disabled"]."|".$user["firstName"]."|".$user["lastName"]."|".$user["emailAddress"]."|".$user["alias"]."|".$user["loginId"]."\n";
                     $content .= $user["id"] . ":" . $user["firstName"] . "," . $user["lastName"] . "\n";
                 }
                 $result = $this->transmitText($obj, $content);
                 break;
             case "code":
                 $appid = APPID;
                 $redirect_uri = REDIRECT_URI;
                 $auth_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" . $appid . "&redirect_uri=" . $redirect_uri . "&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
                 $content = 'DupliCALL UCenter Oauth2.0 <a href="' . $auth_url . '">点击这里进行授权</a>';
                 $result = $this->transmitText($obj, $content);
                 break;
             case "auth":
                 $appid = APPID;
                 $appsecret = APPSECRET;
                 $mysql = new SaeMysql();
                 $sql = "SELECT * FROM `gParameters` WHERE `name` ='gAuthCode'";
                 $data = $mysql->getLine($sql);
                 $authCode = $data["Value"];
                 $mysql->closeDb();
                 $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $appid . "&secret=" . $appsecret . "&code=" . $authCode . "&grant_type=authorization_code";
                 $result1 = https_request($url);
                 $jsoninfo = json_decode($result1, true);
                 $authAccessToken = $jsoninfo["access_token"];
                 $authRefreshToken = $jsoninfo["refresh_token"];
                 $authOpenId = $jsoninfo["openid"];
                 $authScope = $jsoninfo["scope"];
                 $userinfo_url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $authAccessToken . "&openid=" . $authOpenId;
                 $userinfo_json = https_request($userinfo_url);
                 $userinfo_array = json_decode($userinfo_json, true);
                 $userOpenid = $userinfo_array["openid"];
                 $userNickname = $userinfo_array["nickname"];
                 if ($userinfo_array["sex"] == 1) {
                     $userSex = "先生";
                 } else {
                     $userSex = "女士";
                 }
                 $userLanguage = $userinfo_array["language"];
                 $userCity = $userinfo_array["city"];
                 $userProvince = $userinfo_array["province"];
                 $userCountry = $userinfo_array["country"];
                 $userImg = $userinfo_array["headimgurl"];
                 $content1 = "OpenId : " . $userOpenid . "\n Nickname : " . $userNickname . "\n Sex : " . $userSex . "\n Language : " . $userLanguage . "\n Location : " . $userCountry . "/" . $userProvince . "/" . $userCity . "\n";
                 //$content .= '<img src="'. $userImg.'" >';
//.........这里部分代码省略.........
开发者ID:initialb,项目名称:UCMS,代码行数:101,代码来源:index.duplicall.php

示例6: runquery

<?php

$lvyi_db = new SaeMysql();
//install
$sql = file_get_contents('./db.sql');
//do
runquery($sql);
//report
if ($lvyi_db->errno() != 0) {
    die("Error:" . $lvyi_db->errmsg());
}
$lvyi_db->closeDb();
//include success template
function runquery($sql)
{
    global $lvyi_db;
    $sql = str_replace("\r", "\n", $sql);
    $ret = array();
    $num = 0;
    foreach (explode(";\n", trim($sql)) as $query) {
        $queries = explode("\n", trim($query));
        foreach ($queries as $query) {
            $ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
        }
        $num++;
    }
    unset($sql);
    $strtip = "";
    foreach ($ret as $query) {
        $query = trim($query);
        if ($query) {
开发者ID:RX78NY1,项目名称:hustoj,代码行数:31,代码来源:install.php

示例7: RunSaeSql

 static function RunSaeSql($sql)
 {
     $mysql = new SaeMysql();
     self::$result_str = $sql;
     $mysql->runSql($sql);
     $mysql->closeDb();
 }
开发者ID:AxellH,项目名称:wxprinter,代码行数:7,代码来源:sae_tool.php

示例8: receiveText

 private function receiveText($object)
 {
     $mem = memcache_init();
     $userid_fback = $mem->get($object->FromUserName . "fbkey");
     $userid_view = $mem->get($object->FromUserName . "viewkey");
     if ($object->FromUserName . "fback" == $userid_fback) {
         $mysql = new SaeMysql();
         $sql = "INSERT  INTO `tb_feedback` ( `userid`, `time`, `content`) VALUES ('" . $object->FromUserName . "',NOW(),'" . $object->Content . "')";
         $mysql->runSql($sql);
         $mysql->closeDb();
         $content = "谢谢反馈";
         $result = $this->transmitText($object, $content);
         $mem->delete($object->FromUserName . "fbkey");
     } else {
         if ($object->FromUserName . "view" == $userid_view) {
             $num = $object->Content;
             $sql = "SELECT * FROM `tb_exhibit` WHERE number = " . $num;
             $mysql = new SaeMysql();
             $result = $mysql->getLine($sql);
             $mysql->closeDb();
             $content = array();
             $content[] = array("Title" => $result['title'], "Description" => $result['description'], "PicUrl" => $result['picurl'], "Url" => "");
             $result = $this->transmitNews($object, $content);
             $mem->delete($object->FromUserName . "viewkey");
             return $result;
         } else {
             $keyword = $object->Content;
             $url = "http://www.tuling123.com/openapi/api?key=1dfd7a09ee0aafd4eb7b243a470f8657&info=" . $keyword;
             $res = file_get_contents($url);
             $resjson = json_decode($res);
             $content = $resjson->text;
             $result = $this->transmitText($object, $content);
         }
     }
     return $result;
 }
开发者ID:AAYuan,项目名称:museum,代码行数:36,代码来源:museum.php

示例9: saveping

 public function saveping($source, $destination, $min, $avg, $max, $loss)
 {
     $mysql = new SaeMysql();
     $sql = "INSERT INTO `ping` (`source`, `destination`, `min`, `avg`, `max`, `loss`, `time`)" . " VALUES ('" . $mysql->escape($source) . "', '" . $mysql->escape($destination) . "', " . $min . ", " . $avg . ", " . $max . ", " . $loss . ", NOW())";
     $mysql->runSql($sql);
     if ($mysql->errno() != 0) {
         log_message('error', "MySQL Error: " . $mysql->errmsg());
         //die( "Error: " . $mysql->errmsg() );
         die($sql);
     }
     $mysql->closeDb();
 }
开发者ID:udng,项目名称:looking-glass-php-sae,代码行数:12,代码来源:Dblib.php

示例10: responseMsg


//.........这里部分代码省略.........
                                         break;
                                 }
                             } else {
                                 if ($customevent == "SCAN") {
                                     //$postObj->EventKey = substr($postObj->EventKey, 8, strlen($postObj->EventKey)-8);
                                     $sql = "SELECT * FROM devConnect WHERE user='{$postObj->EventKey}' ";
                                     //判断有无此设备
                                     $query = mysql_query($sql);
                                     //执行sql语句
                                     if (!$query) {
                                         die("insert into Sheet1: " . mysql_error());
                                     }
                                     $rs = mysql_fetch_array($query);
                                     $USER = $rs['user'];
                                     //设备号
                                     if ($USER == $postObj->EventKey) {
                                         //有此设备
                                         $sql = "update devConnect set qq='{$fromUsername}' where user={$postObj->EventKey}";
                                         //绑定设备
                                         $query = mysql_query($sql);
                                         //执行sql语句
                                         $contentStr = "设备绑定成功" . $postObj->EventKey;
                                         if (!$query) {
                                             die("update devConnect: " . mysql_error());
                                             $contentStr = "设备绑定失败,请重新绑定";
                                         }
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     } else {
                                         $contentStr = "绑定失败,请重新绑定";
                                         $msgType = "text";
                                         $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                                     }
                                 }
                             }
                         }
                         break;
                     default:
                         $sql0 = "SELECT * FROM devRegister WHERE qq='{$fromUsername}' ";
                         //判断是否要绑定
                         $query0 = mysql_query($sql0);
                         //执行sql语句
                         if (!$query0) {
                             die("SELECT * FROM devRegister: " . mysql_error());
                         }
                         $rs0 = mysql_fetch_array($query0);
                         $USER = $rs0['qq'];
                         if ($USER == $fromUsername) {
                             //绑定操作
                             $sql = "SELECT * FROM devConnect WHERE devID='{$keyword}' ";
                             //判断有无此设备
                             $query = mysql_query($sql);
                             //执行sql语句
                             if (!$query) {
                                 die("SELECT * FROM devConnect: " . mysql_error());
                             }
                             $rs = mysql_fetch_array($query);
                             $USER = $rs['devID'];
                             if ($USER == $keyword) {
                                 //有此设备
                                 $sql = "update devConnect set qq='{$fromUsername}' where devID={$USER}";
                                 //绑定设备
                                 $query = mysql_query($sql);
                                 //执行sql语句
                                 if (!$query) {
                                     die("update devConnect: " . mysql_error());
                                     $contentStr = "设备绑定失败,请重新绑定";
                                 } else {
                                     $contentStr = "设备绑定成功";
                                 }
                                 $msgType = "text";
                                 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                             } else {
                                 $contentStr = "设备绑定失败,请重新绑定";
                                 $msgType = "text";
                                 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                             }
                             $sql0 = "delete FROM devRegister WHERE qq='{$fromUsername}' ";
                             //判断是否要绑定
                             $query0 = mysql_query($sql0);
                             //执行sql语句
                             if (!$query0) {
                                 die("delete * FROM devRegister: " . mysql_error());
                             }
                         } else {
                             $contentStr = "******" . "欢迎新朋友\n请绑定设备";
                             $msgType = "text";
                             $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
                         }
                         break;
                 }
             }
             $mysql->closeDb();
         }
         echo $resultStr;
     } else {
         echo "";
         exit;
     }
 }
开发者ID:zekaigit,项目名称:yijianchelian,代码行数:101,代码来源:weixin.php

示例11: update

	public function update(){
		$query = "update toupiao set {$this->pingwei} = {$this->score} where keshi_name = '{$this->jiemu}'";
		//echo $query;
		$mysql = new SaeMysql();
		$query_submit = "select didSubmit from score_pingwei where score like '{$this->pingwei}'";
		$resultOfQuery_submit = $mysql->getData($query_submit);
		//var_dump($this->pingwei);
		//var_dump($resultOfQuery_submit);
		if ($resultOfQuery_submit[0]["didSubmit"] > 1 || ($this -> score>100)|| ($this -> score<75)) {
			# code...

			$this->show_error();
			
		}else{
			

			$mysql->runSql( $query );
			$mysql->closeDb();
			$this->show_success();
					}
			
	}
开发者ID:sueflybaby,项目名称:learngit,代码行数:22,代码来源:insert.php

示例12: upuserlock

function upuserlock($lock, $username)
{
    $mysql = new SaeMysql();
    $sql = "UPDATE `wx_users` SET  `lock` =  '{$lock}' WHERE  `openid` =  '{$username}'";
    $mysql->runSql($sql);
    if ($mysql->errno() != 0) {
        die("Error:" . $mysql->errmsg());
    }
    $mysql->closeDb();
}
开发者ID:funny-guess,项目名称:wechat-server-php,代码行数:10,代码来源:test.php

示例13: _getNewAccessToken

 /**
  * 调用微信接口,重新获取access_token
  * @return  string
  */
 private function _getNewAccessToken()
 {
     // 获取新的access_token
     $apiUrl = sprintf($this->_apiUrl, APP_ID, APP_SECRET);
     $newAccessToken = Curl::doCurl($apiUrl);
     // 判断是否获取成功
     if (!$newAccessToken['errcode'] && !empty($newAccessToken['access_token'])) {
         // 将新获取的access_token更新到数据库
         $c_time = time() - 200;
         // 将获取到的时间提前一点
         $mysql = new SaeMysql();
         $sql = "SELECT `c_time`, `t_value` FROM `weixin_access_token`";
         $data = $mysql->getData($sql);
         //$data = DbPDO::table('weixin_access_token')->find();
         if (!$data) {
             // 首次插入
             //DbPDO::table('weixin_access_token')->where(array('id'=>1))->add(array('c_time' => $c_time, 't_value' => $newAccessToken['access_token']));
             $sql = "INSERT INTO `weixin_access_token` (`c_time`, `t_value`) VALUES ({$c_time}, " . $newAccessToken['access_token'] . ")";
         } else {
             // 修改
             //DbPDO::table('weixin_access_token')->where(array('id'=>1))->save(array('c_time' => $c_time, 't_value' => $newAccessToken['access_token']));
             $sql = "UPDATE `weixin_access_token` SET `c_time` = {$c_time} , `t_value` = " . $newAccessToken['access_token'] . " WHERE id = 1";
         }
         $mysql->runSql($sql);
         $mysql->closeDb();
     } else {
         throw new Exception($newAccessToken['errcode'] . '-' . $newAccessToken['errmsg']);
     }
     return $newAccessToken['access_token'];
 }
开发者ID:pemako,项目名称:weixin,代码行数:34,代码来源:AccessToken.class.php

示例14: get_JS_Access_Token

function get_JS_Access_Token()
{
    $appid = APPID;
    $appsecret = APPSECRET;
    $nowTime = time();
    $mysql = new SaeMysql();
    $sql = "SELECT * FROM `gParameters` WHERE `name` ='gJSAccessToken'";
    $data = $mysql->getLine($sql);
    $JSAccessToken = $data["Value"];
    //	sae_debug("accessToken = ".$accessToken);
    $sql = "SELECT * FROM `gParameters` WHERE `name` ='gJSTokenTime'";
    $data = $mysql->getLine($sql);
    $JSTokenTime = $data["Value"];
    if ($nowTime - $JSTokenTime > 7000) {
        $accessToken = get_Access_Token();
        $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=" . $accessToken;
        $outputToken = https_request($url);
        $jsoninfo = json_decode($outputToken, true);
        $JSAccessToken = $jsoninfo["ticket"];
        $sql = "UPDATE `gParameters` SET `Value` ='" . $JSAccessToken . "' WHERE `name` ='gJSAccessToken'";
        $mysql->runSql($sql);
        $sql = "UPDATE `gParameters` SET `Value` ='" . $nowTime . "' WHERE `name` ='gTokenTime'";
        $mysql->runSql($sql);
    }
    $mysql->closeDb();
    return $JSAccessToken;
}
开发者ID:initialb,项目名称:UCMS,代码行数:27,代码来源:utility.php

示例15: ShowDiff

function ShowDiff($group_id, $from, $to, &$summary)
{
    $mysql = new SaeMysql();
    $sql = "SELECT url FROM `url` WHERE `group_id`=" . $group_id;
    $urls = $mysql->getData( $sql );
    $results = array();
    
    for($i = 0; $i < sizeof($urls); ++$i)
    {
        $title = "";
        $content_diff = "";
        
        $sql_from = "SELECT content FROM `web_content` WHERE `url`='" . $urls[$i]['url'] . "' AND `date`='" . $from . "'";
        $sql_to = "SELECT content FROM `web_content` WHERE `url`='" . $urls[$i]['url'] . "' AND `date`='" . $to . "'";

        $content_from = $mysql->getVar( $sql_from );
        $content_to = $mysql->getVar( $sql_to );
       
        if (!$content_from || !$content_to)
        {
            array_attach($results, foutput('failed', $urls[$i]['url'], NULL, $summary));
        }
        else
        {
            if ($content_from !== $content_to)
            {
                $content_diff = GetFormattedDiff($content_from, $content_to);
                
                if (is_string($content_diff))
                {
                    array_attach($results, foutput('changed', $urls[$i]['url'], $content_diff, $summary));
                }
                else
                {
                    array_attach($results, foutput('error', $urls[$i]['url'], NULL, $summary));
                }
            }
            else
            {
                array_attach($results, foutput('identical', $urls[$i]['url'], NULL, $summary));
            }
        }
    }
    
    $mysql->closeDb();
    
    return $results;
}
开发者ID:0902horn,项目名称:urlwatcher-sae,代码行数:48,代码来源:diff.php


注:本文中的SaeMysql::closeDb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。