如何将tips-1068202应用于实际操作中,以提升工作效率?
- 内容介绍
- 文章标签
- 相关推荐
本文共计507个文字,预计阅读时间需要3分钟。
plaintextPHP代码片段:$wechat->valid(); // Token验证include 'wechat.inc.php';$_appid=$appid;$_this_appsecret=$appsecret;$_this_token=$token;private function _request($curl, $https=true, $post='...');
tips-1068202-00.PHPindex.php responseMsg() //$wechat->valid();//Token验证 ?> tips-1068202-01.PHP
wechat.inc.php
_appid = $appid;
$this->_appsecret = $appsecret;
$this->_token = $token;
}
private function _request($curl, $api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$this->_appid."&secret=".$this->_appsecret);
file_put_contents($file, $content);
$content = json_decode($content);
return $content->access_token;
}
public function responseMsg()
{
//get post data, May be due to the different environments
$postStr = file_get_contents("php://input");
//extract post data
if (!empty($postStr))
{
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
if (!empty($postObj))
{
switch($postObj->MsgType)
{
case 'text':
$this->_doText($postObj);
break;
default: exit;
}
}
}
else
{
echo "";
exit;
}
}
private function _doText($postObj)
{
$fromUsername = $postObj->FromUserName;
$toUsername = $postObj->ToUserName;
$keyword = trim($postObj->Content);
$time = time();
$textTpl = "
kintone.php _subDomain . ".cybozu.com:443", "Content-Type: application/json", "X-Cybozu-API-Token: " . $this->_apiToken ); $url = "" . $this->_subDomain . ".cybozu.com/k/v1/record.json"; $record = array( "创建人" => array( "value" => array("code"=>$this->_createCode) ), "日期" => array( "value" => date("Y-m-d") ), "内容" => array( "value" => $content )); $data = array( "app" => $this->_appId, "record" => $record ); $response = $this->_request($url, true, "post", json_encode($data), $header); $response = json_decode($response); if ($response->version) { return $response->id; } return $response->message; } private function _request($curl, $https = true, $post = "get", $data = null, $header = null, $type = null) { $Curl = new Curl(); return $Curl->_request($curl, $https, $post, $data, $header, $type); } } ?> tips-1068202-03.PHP
curl.php
本文共计507个文字,预计阅读时间需要3分钟。
plaintextPHP代码片段:$wechat->valid(); // Token验证include 'wechat.inc.php';$_appid=$appid;$_this_appsecret=$appsecret;$_this_token=$token;private function _request($curl, $https=true, $post='...');
tips-1068202-00.PHPindex.php responseMsg() //$wechat->valid();//Token验证 ?> tips-1068202-01.PHP
wechat.inc.php
_appid = $appid;
$this->_appsecret = $appsecret;
$this->_token = $token;
}
private function _request($curl, $api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$this->_appid."&secret=".$this->_appsecret);
file_put_contents($file, $content);
$content = json_decode($content);
return $content->access_token;
}
public function responseMsg()
{
//get post data, May be due to the different environments
$postStr = file_get_contents("php://input");
//extract post data
if (!empty($postStr))
{
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
if (!empty($postObj))
{
switch($postObj->MsgType)
{
case 'text':
$this->_doText($postObj);
break;
default: exit;
}
}
}
else
{
echo "";
exit;
}
}
private function _doText($postObj)
{
$fromUsername = $postObj->FromUserName;
$toUsername = $postObj->ToUserName;
$keyword = trim($postObj->Content);
$time = time();
$textTpl = "
kintone.php _subDomain . ".cybozu.com:443", "Content-Type: application/json", "X-Cybozu-API-Token: " . $this->_apiToken ); $url = "" . $this->_subDomain . ".cybozu.com/k/v1/record.json"; $record = array( "创建人" => array( "value" => array("code"=>$this->_createCode) ), "日期" => array( "value" => date("Y-m-d") ), "内容" => array( "value" => $content )); $data = array( "app" => $this->_appId, "record" => $record ); $response = $this->_request($url, true, "post", json_encode($data), $header); $response = json_decode($response); if ($response->version) { return $response->id; } return $response->message; } private function _request($curl, $https = true, $post = "get", $data = null, $header = null, $type = null) { $Curl = new Curl(); return $Curl->_request($curl, $https, $post, $data, $header, $type); } } ?> tips-1068202-03.PHP
curl.php

