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


PHP model::get方法代碼示例

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


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

示例1: Fields

 /**
  * @param array $columns
  * @return mixed
  */
 public function Fields(array $columns)
 {
     $response = array();
     if (count($columns) > 0) {
         $response = $this->_model->get($columns);
     }
     return $response;
 }
開發者ID:jbenzshawel,項目名稱:LaravelBlog,代碼行數:12,代碼來源:Repository.php

示例2: addAction

 function addAction()
 {
     if ($this->isget()) {
         $model = new model('seven_rule');
         $info = $model->get('*', array('id' => $_GET['id']));
         $this->assign('info', $info);
         $this->display();
     } else {
         $model = new model();
         $model->table('seven_rule');
         $times = $_POST['times'];
         $data['rule'] = $_POST['rule'];
         if (!$model->has(array('times' => $times))) {
             $data['times'] = $times;
             $rs = $model->insert($data);
         } else {
             $rs = $model->update($data, array('times' => $times));
         }
         if ($rs) {
             $this->json('操作成功');
         } else {
             $this->json('操作失敗', 0);
         }
     }
 }
開發者ID:eyblog,項目名稱:mvc,代碼行數:25,代碼來源:signController.class.php

示例3: getWhere

 public function getWhere($id)
 {
     $db = new model($this->_table);
     $db->open();
     $db->where(array('account' => ':account'));
     $db->params(array(':account' => $id));
     $data = $db->get();
     $db->close();
     return $data;
 }
開發者ID:peterclink,項目名稱:webservice,代碼行數:10,代碼來源:inviteModel.php

示例4: doAction

 function doAction()
 {
     //獲取任務開始時間
     $model = new model('seven_set');
     $set = $model->get('*', array('id' => 1));
     $start = $set['start'] ? $set['start'] : strtotime(date('Ymd'));
     //檢測是否有簽到記錄
     $data['openid'] = $_SESSION['openid'];
     $data['addtime'] = empty($_POST['date']) ? strtotime(date('Y-m-d')) : $start + 86400 * ($_POST['date'] - 1);
     $is_sign = $this->list->has(array('AND' => $data));
     //檢測是否上傳圖片
     if (empty($_POST["img"])) {
         $this->json('請上傳圖片', 0);
     }
     $file_path = "static/upload/seven/";
     if (!file_exists($file_path) || !is_writable($file_path)) {
         @mkdir($file_path, 0755, true);
     }
     $img = base64_decode(str_replace('data:image/jpeg;base64,', "", $_POST['img']));
     $src = $file_path . date('Ymdhis') . rand(1000, 9999) . '.jpg';
     file_put_contents($src, $img);
     //旋轉圖片
     if (!empty($_POST['deg'])) {
         //創建圖像資源,以jpeg格式為例
         $source = imagecreatefromjpeg($src);
         //使用imagerotate()函數按指定的角度旋轉
         $rotate = imagerotate($source, $_POST['deg'], 0);
         //旋轉後的圖片保存
         imagejpeg($rotate, $src);
     }
     //寫入簽到記錄
     if ($is_sign) {
         $res = $this->list->update(array('src' => $src), array('AND' => $data));
     } else {
         $data['src'] = $src;
         $res = $this->list->insert($data);
     }
     if (!$res) {
         $this->json('簽到失敗', 0);
     }
     //增加連續簽到天數
     $map['openid'] = $_SESSION['openid'];
     $rs = $this->user->get('*', $map);
     unset($data['src']);
     if (!$rs) {
         //沒有記錄則新增數據
         $data['total'] = 1;
         $this->user->insert($data);
     } else {
         //有記錄則更新數據
         $this->user->update(array('addtime' => $data['addtime'], 'total[+]' => 1), $map);
     }
     $this->json($is_sign ? '修改成功' : '簽到成功', 1);
 }
開發者ID:eyblog,項目名稱:mvc,代碼行數:54,代碼來源:sevenController.class.php

示例5: indexAction

 function indexAction()
 {
     //$_SESSION['openid']='orSDHtyha_AlF4dm4NZyLId-OUps';
     if ($_GET['step'] != 5) {
         $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbe73369f870a0158&redirect_uri=http%3a%2f%2fh5.jiang-mei.com%2fyiboh5%2fcms%2fcp%2f?step=0&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
         $this->getToken($url);
     }
     //第N步
     $step = isset($_GET['step']) ? $_GET['step'] : '0';
     $model = new model('seven_set');
     //時間
     $set = $model->get('*', array('id' => 1));
     $start = $set['start'] ? $set['start'] : strtotime(date('Ymd'));
     //測試七天數據
     $this->assign('set', $set);
     //打卡說明
     $day = empty($_GET['day']) ? date('Y-m-d') : $_GET['day'];
     //測試期間允許自定義時間
     //活動開始時間
     $set = $model->table('seven_set')->get('*', array('id' => 1));
     $start = $set['start'] ? $set['start'] : strtotime(date('Ymd'));
     //判斷今天是活動第幾天
     $now = (strtotime($day) - $start) / 86400 + 1;
     $this->assign('day', $now);
     //是否在活動日期內
     if ($now > 0 && $now < 8) {
         $rule = $model->table('seven_rule')->get('*', array('times' => $now));
         $this->assign('rule', $rule);
         $this->assign('date', $day);
     } else {
         $this->assign('error', 1);
     }
     //獲取當前用戶今天打卡信息
     $map['openid'] = $_SESSION['openid'];
     $map['addtime'] = strtotime(date('Ymd'));
     $info = $model->table('seven_list')->get('*', array('AND' => $map));
     $this->assign('info', $info);
     //第五步
     if ($step == 5) {
         $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbe73369f870a0158&redirect_uri=http%3a%2f%2fh5.jiang-mei.com%2fyiboh5%2fcms%2fcp%2f?step=5&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
         $this->getToken($url);
         $data = $this->getList();
         $this->assign('total', $data['total']);
         $this->assign('list', $data['date']);
         $this->assign('top', $this->getTop());
     }
     $this->assign('src', "http://" . $_SERVER['HTTP_HOST'] . __ROOT__ . '/static/home/images/fx1.jpg');
     $this->display('cp_index' . $step);
 }
開發者ID:eyblog,項目名稱:mvc,代碼行數:49,代碼來源:cpController.class.php

示例6: text

    public function text()
    {
        $a = function ($ad) {
            return $ad;
        };
        echo $a(22322);
    }
}
$a = new Test();
//echo $a->text();
class NoFoundException extends Exception
{
}
class No2FoundException extends Exception
{
}
class model
{
    public function get()
    {
        throw new NoFoundException('sdfsdfsdfdsf');
    }
}
try {
    $model = new model();
    $model->get();
} catch (No2FoundException $e) {
    echo 'Caught exception: ', $e->getMessage(), '<br>';
}
// 繼續執行
echo 'Hello World';
開發者ID:shsrain,項目名稱:ShsrainWeChat,代碼行數:31,代碼來源:class.php


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