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


PHP LogHelper::saveCatLogSubscribe方法代码示例

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


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

示例1: sendEmails

 static function sendEmails(array $subscribeUzUserGroups, $messageSubject, $messageText, $subscribesUzGroup = 0)
 {
     if (!empty(Yii::app()->params["SubscribesUz"]) && sizeof($subscribeUzUserGroups) > 0) {
         // Данные которые предостовляет Subscribes.uz
         $SubscribesUzHash = Yii::app()->params["SubscribesUz"]["hash"];
         $SubscribesUzUserEmail = Yii::app()->params["SubscribesUz"]["userEmail"];
         $subscribesUzGroup = $subscribesUzGroup > 0 ? $subscribesUzGroup : Yii::app()->params["SubscribesUz"]["group"];
         // Данные которые предостовяет пользователь
         $listUserGroups = implode("-", $subscribeUzUserGroups);
         $messageSubject = trim($messageSubject);
         $messageText = trim($messageText);
         if (sizeof($listUserGroups) && !empty($messageSubject) && !empty($messageText)) {
             $userHash = substr(md5(md5($SubscribesUzUserEmail . $SubscribesUzHash) . date("Y-m-d H")), 0, 15);
             $messageText = str_replace(array("?", "&", "description"), array("@v;", "@a;", "@desc;"), $messageText);
             $postFields = "message-user-groups=" . $listUserGroups . "&message-subject=" . $messageSubject . "&message-text=" . $messageText;
             $postFields .= "&user-email=" . $SubscribesUzUserEmail . "&hash=" . $userHash . "&group=" . $subscribesUzGroup;
             // echo $postFields;
             $url = Yii::app()->params["SubscribesUz"]["url"] . "addqueue";
             //echo $url."<br/>";
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url);
             // set url to post to
             curl_setopt($ch, CURLOPT_FAILONERROR, 1);
             //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             // return into a variable
             curl_setopt($ch, CURLOPT_TIMEOUT, 3);
             // times out after 4s
             curl_setopt($ch, CURLOPT_POST, 1);
             // set POST method
             curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
             // add POST fields
             $result = curl_exec($ch);
             // run the whole process
             curl_close($ch);
             if ($result === FALSE) {
                 echo "cURL Error: " . curl_error($ch);
             } else {
                 echo $result;
                 // Логируем
                 LogHelper::saveCatLogSubscribe();
                 return true;
             }
             //echo $result;
         }
     } else {
         throw new ExceptionClass('Error SubscribesUz: Не указанны данные для подключения');
     }
     return false;
 }
开发者ID:bogiesoft,项目名称:yii-travel,代码行数:50,代码来源:SubscribesUzHelper.php


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