当前位置: 首页>>代码示例>>PHP>>正文


PHP Connect::connect方法代码示例

本文整理汇总了PHP中Connect::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Connect::connect方法的具体用法?PHP Connect::connect怎么用?PHP Connect::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connect的用法示例。


在下文中一共展示了Connect::connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendGCMMessage

 public static function sendGCMMessage($title, $msg, $eventoId, $disciplina)
 {
     include "../webservice/connection/Connect.php";
     $db = new Connect();
     $connection = $db->connect();
     //$acao = $_POST['acao'];
     // if ($acao == "enviar") {
     $jsonArray = array();
     $sql = $connection->prepare("SELECT app_dispositivo.registration_id FROM henriqueweb.app_dispositivo");
     $sql->execute();
     if ($sql->rowCount() > 0) {
         while ($tmp = $sql->fetch()) {
             $jsonArray[] = $tmp["registration_id"];
         }
     }
     //$mensagem = $_POST["mensagem"];
     //$eventoId = $_POST["eventoId"];
     $url = "https://gcm-http.googleapis.com/gcm/send";
     $apiKey = "AIzaSyD4-EStQ8w7G8FP2plyIkIOJ10LljchUpw";
     $ch = curl_init($url);
     $jsonData = array("registration_ids" => $jsonArray, "data" => array("type" => "evento", "title" => $title, "disciplina" => $disciplina, "eventoId" => $eventoId, "mensagem" => $msg));
     $jsonDataEncoded = json_encode($jsonData);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: key=" . $apiKey));
     $result = curl_exec($ch);
     //}
 }
开发者ID:luizhsda10,项目名称:UFMSApp,代码行数:28,代码来源:GCMHandler.php

示例2: json_encode

<?php

header('Content-Type: application/json; Charset=UTF-8');
include "../connection/Connect.php";
$db = new Connect();
$connection = $db->connect();
$sql = "UPDATE app_rating_disciplina SET app_rating = ? WHERE (app_aluno_key = ?) AND (app_disciplina_key = ?)";
$query = $connection->prepare($sql);
$disciplinaRating = $_POST['disciplinaRating'];
$alunoKey = $_POST['alunoKey'];
$disciplinaKey = $_POST['disciplinaKey'];
$query->execute(array($disciplinaRating, $alunoKey, $disciplinaKey));
$returnJson = array("updated" => $query->rowCount());
echo json_encode($returnJson);
开发者ID:luizhsda10,项目名称:UFMSApp,代码行数:14,代码来源:updateRateDisciplina.php


注:本文中的Connect::connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。