當前位置: 首頁>>代碼示例>>PHP>>正文


PHP connect::query方法代碼示例

本文整理匯總了PHP中connect::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP connect::query方法的具體用法?PHP connect::query怎麽用?PHP connect::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在connect的用法示例。


在下文中一共展示了connect::query方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getToken

function getToken()
{
    require_once 'comm.php';
    $currnet = time();
    $Token_result = new connect();
    $sql = "SELECT * FROM options where type='token'";
    $result = $Token_result->query($sql);
    $arr = mysql_fetch_array($result);
    $time_token = $arr['value'];
    if ($currnet >= $time_token) {
        $appid = "wxa2986e7d8863b2ab";
        $secret = "08d000097799e646d11b57e0acd71a9f";
        $access_token = file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}");
        $access_token = json_decode($access_token);
        $access_token = $access_token->{'access_token'};
        //修改新的token信息
        $time = $currnet + 7200;
        $sql = "UPDATE options SET title='" . $access_token . "',value='" . $time . "' where type='token'";
        $Token_result->query($sql);
    } else {
        $access_token = $arr['title'];
        //$access_token ="48QToD2xXqQSwSNF8uqn6iF3o3P4yDEqvrrxaDDO0nxqcZFgg95IwA_xAafzwhsVxcM4Hh0tQTtwIcTqFxEa_B1IUpXE67cVUmpBnq_09rE";
    }
    return $access_token;
}
開發者ID:wfqdreamcity,項目名稱:wellcn,代碼行數:25,代碼來源:getTokenMessage.php

示例2: connect

<?php

header("Content-type:text/html;charset=utf-8");
require_once 'comm.php';
$page = 0;
$pagesize = 20;
if ($_POST['page']) {
    $page = $_POST['page'];
}
$start = $pagesize * $page;
echo "<form action='sendMessage.php' method='post'>\n\t\t\t<table>\t\n\t\t\t\t<input type='hidden' name='page' id='page' value=" . ($page + 1) . " />\n\t\t\t\t<input type='submit' value='NextPage' />\n\t\t\t</table>\n\t </form>";
$connect = new connect();
$list = $connect->query("SELECT * FROM ecs_chat_log ORDER BY time DESC LIMIT {$start},{$pagesize}");
while ($arr = mysql_fetch_array($list)) {
    echo $arr['time'] . "=>" . $arr['nickname'] . ":" . $arr['message'] . "<br />";
    echo "<form action='sendMessage.php' method='post'>\n\t\t\t<table>\n\t\t\t\t<input type='text' name='message' id='message' />\n\t\t\t\t<input type='hidden' name='openid' id='openid' value=" . $arr['openid'] . " />\n\t\t\t\t<input type='hidden' name='page' id='page' value=" . $page . "/>\n\t\t\t\t<input type='submit' value='send' />\n\t\t\t</table>\n\t </form>";
}
//$result = $connect->query("INSERT INTO ecs_chat_log (openid,message,nickname,time) VALUES('".$openid."','".$Content."','".$nickname."','".$CreateTime."')");
if ($_POST['message'] && $_POST['openid']) {
    require_once 'getTokenMessage.php';
    $message = $_POST['message'];
    $openid = $_POST['openid'];
    unset($_POST['message']);
    $access_token = getToken();
    $content = '{
		"touser":"' . $openid . '",
		"msgtype":"text",
		"text":
		{
			 "content":"' . $message . '"
		}
開發者ID:wfqdreamcity,項目名稱:wellcn,代碼行數:31,代碼來源:sendMessage.php


注:本文中的connect::query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。