本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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';