本文整理汇总了PHP中model::getByField方法的典型用法代码示例。如果您正苦于以下问题:PHP model::getByField方法的具体用法?PHP model::getByField怎么用?PHP model::getByField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model
的用法示例。
在下文中一共展示了model::getByField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: model
<?php
/**
* Created by PhpStorm.
* User: novichkov
* Date: 13.12.14
* Time: 1:59
*/
session_start();
require_once 'challenge/model.php';
$model = new model('wp_users');
if (isset($_POST['signin'])) {
$warning = false;
$u = $model->getByField('user_login', $_POST['user_login']);
if (!$_POST['user_login']) {
$warning = 'Username required!';
} elseif (!$_POST['user_email']) {
$warning = 'Email required!';
} elseif (!preg_match("/^.+@.+\\..+\$/", strtolower($_POST['user_email']))) {
$warning = 'Incorrect email!';
} elseif (!$_POST['phone']) {
$warning = 'Phone number required!';
} elseif (strlen($_POST['phone']) < 4) {
$warning = 'Phone number is incorrect!';
}
if (!$warning) {
$row = array();
$row['user_login'] = $_POST['user_login'];
$row['user_email'] = strtolower($_POST['user_email']);
$row['phone'] = $_POST['phone'];
$row['user_nicename'] = $_POST['user_login'];
示例2: 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">