当前位置: 首页>>代码示例>>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;未经允许,请勿转载。