Ejemplo n.º 1
0
Archivo: css.php Proyecto: abachi/MVC
 /**
  * Load css file from public/css folder and get contents.
  *
  * @param (string) $filename - css file name in public folder without (public/css) path.
  * @access protected.
  */
 protected static function load($filename)
 {
     $path = self::path() . $filename;
     if (file_exists($path)) {
         $contents = c_file_get_contents($path);
         return $contents;
     } else {
         trigger_error($path . " file not exists in " . self::path());
     }
 }
Ejemplo n.º 2
0
    curl_setopt($ch, CURLOPT_REFERER, _REFERER_);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $r = curl_exec($ch);
    curl_close($ch);
    return $r;
}
//define your token
define("TOKEN", "111111");
define("appid", "wx203d7eb29a78bce8");
define("appsecret", "94a32b0fd3098d628b019817b23d1075");
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . appid . "&secret=" . appsecret;
$json = $this->http_request_json($url);
$data = json_decode($json, true);
die;
//print_r($_REQUEST);die;
//code存在,获取openid
if ($_GET["code"]) {
    $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . appid . "&secret=" . appsecret . "&code=" . $_GET["code"] . "&grant_type=authorization_code";
    $result = c_file_get_contents($url);
    $result = json_decode($result, true);
    $openid = $result["openid"];
    $access_token = $result["access_token"];
}
//$access_token="OezXcEiiBSKSxW0eoylIeEkH57iStkl2HF-5eSKJh4VSnDJJfopasw3cefmqV-cMAlb1y6VG3bQGvXhUV8xqYv9Ycn7VDOca9y36PhVLPtz7IUET963BZWDLTfW3Q63k_n0eMgrNNgN41U8ns4zN3A";
//if($access_token){//根据openid获取用户信息
$url = "https://api.weixin.qq.com/sns/userinfo?access_token=" . $access_token . "&openid=" . $openid . "&lang=zh_CN";
$result = c_file_get_contents($url);
$result = json_decode($result, true);
print_r($result);
die;
//}