當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Info::where方法代碼示例

本文整理匯總了PHP中Info::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Info::where方法的具體用法?PHP Info::where怎麽用?PHP Info::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Info的用法示例。


在下文中一共展示了Info::where方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: add

 public static function add(array $args)
 {
     $args['receiver_id'] = $args['receiver_id'] ? $args['receiver_id'] : 0;
     $comment = ['parent_id' => $args['parent_id'], 'pro_id' => $args['pro_id'], 'sender_id' => $args['sender_id'], 'receiver_id' => $args['receiver_id'], 'content' => $args['content'], 'status' => 0, 'reg_time' => time()];
     $comm = self::create($comment);
     $goods = Goods::find($comm->pro_id);
     $info = Info::where('user_id', $comm->sender_id)->first();
     $sender = User::find($comm->sender_id);
     $receiver = User::find($comm->receiver_id);
     $comm->sender_author = $sender->username;
     $comm->receiver_author = $receiver->usernmae;
     $comm->pro_name = $goods->pro_name;
     $comm->src = 'uploads/' . $info->head_photo;
     $comm->comments = [];
     return self::success($comm->toArray());
 }
開發者ID:lxyeinsty,項目名稱:TuhaoReviewByLaravel,代碼行數:16,代碼來源:Comments.php

示例2: foreach

 function get_new()
 {
     include 'themes/fundv2/odbc_connect.php';
     $this->load->helper('html');
     $rs = $db->Execute("select * from WEB_NEWS ORDER BY ID DESC");
     // echo "<pre>";
     // print_r($rs);
     // echo "</pre>";
     foreach ($rs as $row) {
         // หาไอดีซ้ำใน db
         $info = new Info();
         $info->where('intranet_id = ' . $row['ID'])->get();
         if ($info->intranet_id == "") {
             $_POST['module'] = 'ข่าวประชาสัมพันธ์';
             $_POST['slug'] = clean_url(iconv('TIS-620', 'UTF-8', $row['TITLE']));
             $_POST['title'] = iconv('TIS-620', 'UTF-8', $row['TITLE']);
             $_POST['detail'] = iconv('TIS-620', 'UTF-8', $row['DETAIL']);
             $_POST['image'] = 'http://intranet.m-society.go.th/upload/newsletters/' . $row['IMG_TITLE'];
             $_POST['intranet_id'] = $row['ID'];
             $rs = new Info();
             $rs->from_array($_POST);
             $rs->save();
             echo 'intranet_news id ' . $_POST['intranet_id'] . ' is insert <br>';
         }
     }
 }
開發者ID:unisexx,項目名稱:imac,代碼行數:26,代碼來源:infos.php


注:本文中的Info::where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。