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


PHP yii::error方法代码示例

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


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

示例1: actionReorder

 /**
  * Reorder the tickets of one column per ajax
  * @return mixed
  * @throws MethodNotAllowedHttpException (405) when not called via ajax
  */
 public function actionReorder()
 {
     $request = Yii::$app->request;
     if ($request->isAjax) {
         $columnId = $request->post('columnId');
         $ticketOrder = $request->post('ticketOrder');
         foreach ($ticketOrder as $ticketOrderKey => $ticketId) {
             $ticket = Ticket::findOne($ticketId);
             $ticket->ticket_order = $ticketOrderKey;
             $ticket->column_id = $columnId;
             if ($ticket->update() === false) {
                 yii::error("Ticket Reordering Error: Column:{$columnId}, Ticket:{$ticketId}, Order:{$ticketOrderKey}");
             }
         }
     } else {
         throw new MethodNotAllowedHttpException();
     }
 }
开发者ID:highestgoodlikewater,项目名称:banthecan,代码行数:23,代码来源:TicketController.php

示例2: httpPost

 /**
  * 以post形式发送数据$data到$url指定的网址
  */
 public static function httpPost($url, $data, $timeout = 30)
 {
     // if (is_array($data)) {
     // 	$data = http_build_query($data);
     // }
     // dd($url,$data);
     $ch = curl_init();
     //考虑 PHP 5.0~5.6 各版本兼容性的 cURL 文件上传
     //http://segmentfault.com/a/1190000000725185
     if (class_exists('CURLFile', false)) {
         curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
     } else {
         if (defined('CURLOPT_SAFE_UPLOAD')) {
             curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
         }
     }
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     //返回数据不包含头信息
     curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
     //刷新链接
     curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     //POST提交的数据
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_USERAGENT, 'TEST PHP5 Client 1.1 (curl) ' . phpversion());
     $result = curl_exec($ch);
     //        $http_code = curl_getinfo ( $ch, CURLINFO_HTTP_CODE );
     $err = curl_error($ch);
     if (false === $result || !empty($err)) {
         $errno = curl_errno($ch);
         $info = curl_getinfo($ch);
         curl_close($ch);
         $data = Json::encode($data);
         $log = "get remote api error {$url}-{$data}-response code is {$errno} and result " . VarDumper::dumpAsString($info);
         \yii::error($log, 'getremoteapi');
         return array('result' => $result, 'errno' => $errno, 'msg' => $err, 'info' => $info);
     }
     curl_close($ch);
     return $result;
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:47,代码来源:HttpHelper.php

示例3: actionReorder

 /**
  * Reorder the columns display order per ajax
  * @return mixed
  * @throws MethodNotAllowedHttpException (405) when not called via ajax
  */
 public function actionReorder()
 {
     $request = Yii::$app->request;
     if ($request->isAjax) {
         $displayOrder = $request->post('displayOrder');
         $newColumnOrder = 1;
         foreach ($displayOrder as $displayOrderKey => $columnId) {
             $column = Column::findOne($columnId);
             $column->display_order = $newColumnOrder;
             //$junk = $column->name;
             //$column->name = $junk;
             if ($column->update() === false) {
                 yii::error("Ticket Reordering Error: Column:{$columnId}, Ticket:{$ticketId}, Order:{$ticketOrderKey}");
             }
             $newColumnOrder++;
         }
     } else {
         throw new MethodNotAllowedHttpException();
     }
 }
开发者ID:highestgoodlikewater,项目名称:banthecan,代码行数:25,代码来源:ColumnController.php

示例4: actionLogin

 public function actionLogin()
 {
     $this->layout = false;
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $message = '';
     $model = new LoginForm();
     if ($model->load(yii::$app->request->post())) {
         if ($model->login()) {
             if ($this->rbacService->checkPermission('manager_admin')) {
                 return $this->goBack();
             } else {
                 yii::$app->user->logout();
                 $message = '您没有权限登录管理系统';
                 yii::error("用户名:{$model->username},密码:{$model->password},{$message}", '登录后台');
             }
         } else {
             yii::error("用户名:{$model->username},密码:{$model->password},{$message}", '登录后台');
         }
     }
     return $this->render('login', ['model' => $model]);
 }
开发者ID:Backflag,项目名称:xlzx,代码行数:23,代码来源:PublicController.php

示例5: getQrImageUrl2

 public function getQrImageUrl2()
 {
     $gh_id = $this->gh_id;
     if (empty($this->scene_id)) {
         // hbhe
         if (yii::$app->mutex->acquire(MStaff::SCENE_LOCK, MStaff::SCENE_LOCK_WAIT_TIME_SECOND)) {
             $this->scene_id = MStaff::newSceneId($this->gh_id);
             $this->save(false);
             //yii::$app->mutex->release($lock);
             yii::$app->mutex->release(MStaff::SCENE_LOCK);
         } else {
             yii::error('acquire lock error');
         }
     }
     $scene_id = $this->scene_id;
     $office_id = $this->office_id;
     $office = MOffice::findOne(['office_id' => $office_id]);
     $office_title = $office->title;
     //$log_file_path = Yii::$app->getRuntimePath().DIRECTORY_SEPARATOR.'qr'.DIRECTORY_SEPARATOR."{$gh_id}_{$scene_id}.jpg";
     $log_file_path = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'qr-all-offices' . DIRECTORY_SEPARATOR . "{$scene_id}_{$office_title}.jpg";
     if (!file_exists($log_file_path) || filesize($log_file_path) == 0) {
         Yii::$app->wx->setGhId($gh_id);
         $arr = Yii::$app->wx->WxgetQRCode($scene_id, true);
         $url = Yii::$app->wx->WxGetQRUrl($arr['ticket']);
         Wechat::downloadFile($url, $log_file_path);
     }
     //$url = Yii::$app->getRequest()->baseUrl."/../runtime/qr/{$gh_id}_{$scene_id}.jpg";
     //return $url;
 }
开发者ID:noikiy,项目名称:wowewe,代码行数:29,代码来源:MStaff.php

示例6: actionR2

 public function actionR2()
 {
     $lock = 'LOCK#1';
     $gh_id = 'G';
     $office_id = rand(1, 100000);
     for ($i = 0; $i < 10000; $i++) {
         if (yii::$app->mutex->acquire($lock, 10)) {
             $staff = new MStaff();
             $staff->gh_id = $gh_id;
             $staff->office_id = $office_id;
             $staff->scene_id = MStaff::newSceneId($gh_id);
             $staff->name = 'office-' . $office_id;
             $staff->cat = MStaff::SCENE_CAT_OFFICE;
             if (!$staff->save(false)) {
                 U::W(['error', __METHOD__, $staff]);
             }
             yii::$app->mutex->release($lock);
         } else {
             yii::error('acquire lock error in R2');
         }
     }
 }
开发者ID:noikiy,项目名称:wowewe,代码行数:22,代码来源:CmdController.php

示例7: getQrImageUrl

 public function getQrImageUrl()
 {
     // hbhe
     if (yii::$app->mutex->acquire(MStaff::SCENE_LOCK, MStaff::SCENE_LOCK_WAIT_TIME_SECOND)) {
         $staff = MStaff::findOne(['gh_id' => $this->gh_id, 'openid' => $this->openid]);
         if (empty($staff)) {
             $staff = $this->newSceneIdForOpenid();
         }
         //yii::$app->mutex->release($lock);
         yii::$app->mutex->release(MStaff::SCENE_LOCK);
     } else {
         yii::error('acquire lock error');
     }
     return $staff->getQrImageUrl();
 }
开发者ID:noikiy,项目名称:wowewe,代码行数:15,代码来源:MUser.php

示例8: afterSave

 public function afterSave($insert, $changedAttributes)
 {
     if ($insert) {
         if ($this->need_scene_id) {
             //hbhe
             if (yii::$app->mutex->acquire(MStaff::SCENE_LOCK, MStaff::SCENE_LOCK_WAIT_TIME_SECOND)) {
                 $staff = new MStaff();
                 $staff->gh_id = $this->gh_id;
                 $staff->office_id = $this->office_id;
                 $staff->scene_id = MStaff::newSceneId($this->gh_id);
                 $staff->name = $this->title;
                 $staff->cat = MStaff::SCENE_CAT_OFFICE;
                 if (!$staff->save(false)) {
                     U::W(['error', __METHOD__, $staff]);
                 }
                 //yii::$app->mutex->release($lock);
                 yii::$app->mutex->release(MStaff::SCENE_LOCK);
             } else {
                 yii::error('acquire lock error');
             }
         }
     }
 }
开发者ID:noikiy,项目名称:wowewe,代码行数:23,代码来源:MOffice.php


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