<?php
//作为外部调用的第一个页面
include "wxid/wechat.class.php";
include 'wxid/errCode.php';
require_once("../Wx.Config.php");
$httppath = WxMainConfig::ServerHttpPath;

$strselchid=trim($_REQUEST['chidno']);
$chsel=trim($_REQUEST['chsel']);

$scope = 'snsapi_base';

$opt = array(
	'appsecret'=>WxMainConfig::APPSECRET,//填写高级调用功能的密钥
	'appid'=>WxMainConfig::APPID	//填写高级调用功能的appid
);

$we = new Wechat($opt);
$auth = $we->checkAuth();
$arr = $we->getOauthAccessToken();
//echo $arr["access_token"];
//echo 'openid='.$arr["openid"];
$oauth_url =  $we->getOauthRedirect($httppath.'wxbooksk/start2.php?chidno='.$strselchid.'&chsel='.$chsel,"wxbase",$scope);
header('Location: ' . $oauth_url);
?>