public function testAction() { /*{ "channel":"alipay_wap", "amount":10, "order_no":"no1234567890", "open_id":"", "a":1, "b":2 }*/ $url = \Pingpp\WxpubOAuth::createOauthUrlForCode($wx_app_id, $redirect_url); var_dump($url); die('333'); }
/** * 获取微信支付时的签名 * * @param null|array $charge * @param null|string $url * @return string * @throws InvalidConfigException */ public function getWechatSignature($charge = null, $url = null) { if ($charge === null) { $charge = $this->getCharge(true); } if (!isset($charge['credential']) || !isset($charge['credential']['wx_pub'])) { throw new \BadMethodCallException('Credential must be ' . Channel::WX_PUB); } $component = $this->getComponent(); $jsApiTicket = $component->getJsApiTicket(); if ($url === null) { $url = Url::current([], true); } return WxpubOAuth::getSignature($this->getCharge(true), $jsApiTicket, $url); }
if ($isWechat) { require __DIR__ . '/../../vendor/pingplusplus/pingpp-php/init.php'; $appId = '******************'; $appSecret = '********************************'; $currentUrl = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; if (!isset($_GET['code'])) { $url = \Pingpp\WxpubOAuth::createOauthUrlForCode($appId, $currentUrl); header('Location: ' . $url); exit; } else { if (session_status() != PHP_SESSION_ACTIVE) { @session_start(); } if (!isset($_SESSION['wechatOpenid'])) { $code = $_GET['code']; $_SESSION['wechatOpenid'] = \Pingpp\WxpubOAuth::getOpenid($appId, $appSecret, $code); } } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <meta name="author" content="Cosmo"> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png"> <title>笑e购</title>
// echo $url; // echo $callback_url; header("Location:" . $url); exit(); } //判定推广 $state = 'arr+Main'; if (isset($_GET['state'])) { $state = $_GET['state']; } else { } //获取open_id $openid = \Pingpp\WxpubOAuth::getOpenid($MY_APP_KEY, $MY_APP_SECRET, $code); echo $openid.'<br>'; //echo "<a href=\"payticket.php?name=陈佳&phone=13489092003&address=济南&kind=1&openid=$openid&state=arr+fashioncj\">购票</a>"; //查询余票&&清除锁定 $nowitme = time() - (45 * 60); $nowitme = date("Y-m-d H:i:s", $nowitme); $sql = "UPDATE ticket SET state=0 WHERE state=1 AND locktime<'{$nowitme}'"; $query = mysqli_query($con, $sql); if ($query) { $sql = "select kind,count(state) from ticket where state=0 group by kind order by kind"; $query=mysqli_query($con,$sql); while($row=mysqli_fetch_array($query)){ echo $row['kind'] . " " . $row['count(state)']; echo "<br />";
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no" /> <meta name="renderer" content="webkit"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <link href="css/player.css" rel="stylesheet"> <title>2015中国企业家年会</title> </head> <body> <?php require_once('init.php'); require_once('initsql.php'); //判定是否授权 $code = ''; if (isset($_GET["code"])) { $code = $_GET['code']; } else { $callback_url = $HOST_URL . 'video.php'; $url = \Pingpp\WxpubOAuth::createOauthUrlForCode($MY_APP_KEY, $callback_url, 'arr+fashioncj', false); header("Location:" . $url); exit(); } ?> <div class="main"> <div class="to-index" style="display: none"><a href="http://mf23.cn/wx/php/main.php">首页</a></div> <div id="mediaplayer"></div> </div> <script src="js/jquery-1.9.1.min.js"></script> <script src="js/jwplayer.js"></script> <script src="js/playvideo.js"></script> </body> </html>
public function getSignature(Charge $charge, $ticket, $url = null) { return WxpubOAuth::getSignature($charge, $ticket, $url); }