本文整理汇总了PHP中model::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP model::insert方法的具体用法?PHP model::insert怎么用?PHP model::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::insert方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
function insert($form)
{
$model = new model();
$final = $model->insert($form);
$result = new controller();
$result->show($final);
}
示例2: send
/**
* Created by PhpStorm.
* User: novichkov
* Date: 24.12.14
* Time: 0:20
*/
function send($to, $subject, $template, $user, array $content = array(), $day = 0, $min_height = 900)
{
if (!file_exists('templates/mails/template.php')) {
include ROOT_DIR . 'templates/mails/template.php';
} else {
include ROOT_DIR . 'templates/mails/template.php';
}
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'To: ' . $user['user_login'] . ' <' . $to . '>' . "\r\n";
$headers .= 'From: "Can Do" Challenge <info@candoweightloss.com>' . "\r\n";
// echo $headers;
//echo $mail;
mail($to, $subject, $mail, $headers);
if ($user['ID']) {
$model = new model('wp_users');
$model->insert(array('ID' => $user['ID'], 'sent' => $day));
}
}
示例3: rand
}
$password = '';
for ($i = 0; $i <= 6; $i++) {
if (rand(1, 2) == 1) {
$password .= $letters[rand(1, 40)];
} else {
$password .= rand(1, 9);
}
}
$row['user_pass'] = md5($password);
if (strtolower($_POST['user_email']) == strtolower($u['user_email']) && $_POST['user_login'] == $u['user_login']) {
$row = array();
unset($password);
$row['ID'] = $u['ID'];
}
$row['sdate'] = date('Y-m-d H:i:s');
$id = $model->insert($row);
$user = $model->getById($id);
require_once ROOT_DIR . 'mail_generator.php';
send($user['user_email'], 'Here are Your Next Steps', 'subscribe', $user, array('password' => $password));
$_SESSION['user_email'] = $_POST['user_email'];
$_SESSION['user_id'] = $id;
header('Location: challenge/success.php');
}
}
require_once ROOT_DIR . 'mobile_detect.php';
$detect = new mobile_detect();
if ($detect->isMobile() || $detect->isTablet()) {
$mobile = true;
}
require_once ROOT_DIR . 'templates/index.php';
示例4: ins
public function ins($arrDados)
{
return parent::insert('clientes', $arrDados);
}
示例5: uploadfoto
public function uploadfoto()
{
$id = $_POST['id_evento_cliente'];
$filepath = "files/fotos/" . date("YmdHis") . ".png";
$imagem = str_replace('data:image/png;base64,', '', $_POST['imagem']);
$this->base64_to_jpeg($imagem, $filepath);
echo json_encode(array('imagem' => 1));
$data['id_evento_cliente'] = $id;
$data['caminho_foto'] = $filepath;
$model = new model();
$model->insert("foto", $data);
}
示例6: uploadFile
public function uploadFile()
{
if ($_FILES["fileToUpload"]['name']['size'] == '') {
header('Location: /participacao');
return;
}
$target_dir = "files/images/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if (isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if ($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 50000000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
$data['id_evento_cliente'] = $this->getParam('id_evento_cliente');
$data['caminho_file'] = $target_file;
$model = new model();
$model->insert("evento_fotos", $data);
header('Location: /participacao');
} else {
echo "Sorry, there was an error uploading your file.";
}
}
}
开发者ID:ErickMaeda,项目名称:controle-eventos-php-cow_tipping_dwarfs,代码行数:52,代码来源:participacaoController.php
示例7: insert
public function insert()
{
parent::insert('presence');
}
示例8: likeAction
function likeAction()
{
if ($this->isget()) {
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbe73369f870a0158&redirect_uri=http%3a%2f%2fh5.jiang-mei.com%2fyiboh5%2fcms%2fcp%2flike%2f?id=" . $_GET['id'] . "&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
$this->getToken($url);
//获取记录详情
$map['id'] = $_GET['id'];
$model = new sevenListModel();
$info = $model->get('*', $map);
//获取当天任务详情
$set = $model->table('seven_set')->get('*', array('id' => 1));
$start = $set['start'] ? $set['start'] : strtotime(date('Ymd'));
$rule = $model->table('seven_rule')->get('*', array('times' => ($info['addtime'] - $start) / 86400 + 1));
$this->assign('rule', $rule);
//获取点赞人数
$like = $model->table('like')->count(array('sid' => $_GET['id']));
$info['like'] = $like;
$this->assign('info', $info);
//判断当前用户是否点赞
$where['sid'] = $_GET['id'];
$where['openid'] = $_SESSION['openid'];
$is_like = $model->has(array('AND' => $where));
$this->assign('is_like', $is_like);
$this->display();
} else {
$map['sid'] = $_POST['id'];
$map['openid'] = $_SESSION['openid'];
$model = new model('like');
if ($model->has(array('AND' => $map))) {
$this->json('您已经点过赞了', 0);
} else {
if ($model->insert($map)) {
$this->json('点赞成功');
} else {
$this->json('点赞失败', 0);
}
}
}
}
示例9: addsAction
function addsAction()
{
$data['openid'] = 'openid' . time();
$data['total'] = 0;
$data['addtime'] = strtotime(date('ymd'));
$model = new model('seven_user');
$model->insert($data);
$this->jump(__ROOT__ . '/admin/sign_seven');
}
示例10: ins
public function ins($arrDados)
{
parent::insert('pedidos', $arrDados);
}
示例11: model
<?php
/**
* Created by PhpStorm.
* User: novichkov
* Date: 19.12.14
* Time: 22:00
*/
require_once 'model.php';
$model = new model('wp_users');
$user = $model->getByField('user_email', $_GET['mail']);
$user['sent'] = 100;
if (isset($_POST['sign_out'])) {
$model->insert($user);
if ($user['ID']) {
$success = true;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div class="row" style="margin-top: 5%;">
<div class="col-lg-4 col-lg-offset-4 col-sm-6 col-sm-offset-3 col-xs-8 col-xs-offset-2">
<div class="panel panel-info" id="main-panel">
<div class="panel-heading text-center">
示例12: produto_save
public function produto_save()
{
$model = new model();
$id = $this->getParam('id_evento');
$produto_evento['id_evento'] = $id;
$produto_evento['id_produto'] = $_POST['id_produto'];
$produto_evento['qtd_produto'] = $_POST['qtd_produto'];
$model->insert('evento_produto', $produto_evento);
header('Location: /evento');
}