• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP medoo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中medoo的典型用法代码示例。如果您正苦于以下问题:PHP medoo类的具体用法?PHP medoo怎么用?PHP medoo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了medoo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: importData

/**
 * 导入数据到 wd_120answer_temp 中
 * @author gaoqing
 * 2015年11月9日
 * @param array $initAskArr 初始要导入的问答信息集
 * @param int $preInsertCount 每次插入的条数
 * @param medoo $connection 连接数据库对象
 * @param int $sleepSeconds 休眠的秒数
 * @return int $importCount 成功导入的信息数
 */
function importData($initAskArr, $preInsertCount, $connection, $sleepSeconds)
{
    $importCount = 0;
    $data = array("isimport" => 1);
    $insertArr = array();
    $updateIDArr = array();
    $initAskArrCount = count($initAskArr);
    foreach ($initAskArr as $key => $initAsk) {
        if ($key % 100 == 0) {
            sleep($sleepSeconds);
        }
        $insertArr[] = getInserArr($initAsk);
        $updateIDArr[] = $initAsk['id'];
        if ($key % $preInsertCount == $preInsertCount - 1 || $key == $initAskArrCount - 1) {
            //将 $insertArr 数组集,插入到 wd_fhanswer_temp 中
            if (!empty($insertArr)) {
                //插入到 wd_120answer_temp 中
                $idArr = $connection->insert(IMPORT_TABLE, $insertArr);
                $importCount += count($insertArr);
                $insertArr = array();
                //更新 wd_120answer_keshi 中的信息
                $where = array('id' => $updateIDArr);
                $connection->update(SELECT_TABLE, $data, $where);
                $updateIDArr = array();
            }
        }
    }
    return $importCount;
}
开发者ID:VampireMe,项目名称:Common_PHP,代码行数:39,代码来源:importData2Local.php


示例2: get_activity_list

 protected function get_activity_list()
 {
     $local_db = new medoo();
     $list = $local_db->select('activity', '*', array('state' => 1));
     $list = two_dimension_array_sort::execute($list, 'id');
     $this->assign('act_list', $list);
 }
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:7,代码来源:activity_boards.php


示例3: get_salary_list

 protected function get_salary_list()
 {
     $total = 0;
     $local = new medoo();
     $user_list = array();
     //需要发工资的大使的ekey列表
     $salary_list = array();
     //所有未结算列表
     $list = $local->select('salary', array('[>]ambassador' => 'ekey'), array('ekey', 'num', 'ambassador.zfb_id', 'ambassador.name'), array('is_give' => 0));
     //        print_r($list);
     //检索出用户列表,拍重,统计总额
     foreach ($list as $v) {
         $total += $v['num'];
         $user_list[$v['ekey']] = '';
     }
     //填充工资列表的工资总额
     foreach ($user_list as $k => $v) {
         $num = 0;
         $name = '';
         $zfb_id = '';
         foreach ($list as $l) {
             if ($l['ekey'] == $k) {
                 $num += $l['num'];
                 $name = $l['name'];
                 $zfb_id = $l['zfb_id'];
             }
         }
         $salary_list[] = array('name' => $name, 'ekey' => $k, 'num' => $num, 'zfb_id' => $zfb_id);
     }
     $this->assign('info', array('total' => $total, 'person' => count($user_list)));
     $this->assign('salary_list', $salary_list);
 }
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:32,代码来源:salary_give_out.php


示例4: login

 function login()
 {
     if (session_id() == '') {
         session_start();
     }
     if (isset($_POST["mail"]) & isset($_POST["password"]) & isset($_POST["cre"])) {
         if ($_POST["mail"] != "" and $_POST["password"] != "" and $_POST["cre"] != "") {
             $mail = $_POST["mail"];
             $password = $_POST["password"];
             $role = $_POST["cre"];
             require_once 'SessionManager.php';
             $session_manager = new SessionManager();
             require_once 'medoo.min.php';
             $database = new medoo();
             $count = $database->count("triotrack_users", ["email" => "{$mail}"]);
             if ($count > 0) {
                 $profile = $database->get("triotrack_users", ["username", "password", "salt", "client"], ["email" => "{$mail}"]);
                 if ($role === "admin") {
                     if ($profile["password"] === sha1($password . $profile["salt"])) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "admin";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 } else {
                     if ($profile["client"] === $password) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "client";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 }
             }
         } else {
             echo "failed";
         }
         exit;
     }
 }
开发者ID:venusdharan,项目名称:Codex-PHP-Framework,代码行数:55,代码来源:AuthenticationManager.php


示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $conf = array();
     include "config.inc.php";
     self::$conf = $conf;
     $ds = self::$conf['db'];
     $database = new medoo(array('database_type' => 'mysql', 'database_name' => $ds['db'], 'server' => $ds['host'], 'port' => $ds['port'], 'username' => $ds['user'], 'password' => $ds['password']));
     $ut_data_schema = $ds['ut_data_schema'];
     $database->query(self::$conf["create_fixture_db"]);
     $database->query(self::$conf["populate_fixture_db"]);
     $database->query("drop database if exists {$ut_data_schema}; create database {$ut_data_schema};");
 }
开发者ID:Adapp,项目名称:propagator,代码行数:12,代码来源:PropagatorModelTest.php


示例6: through_area_get_school

 static function through_area_get_school($area)
 {
     $redis = new Redis();
     $redis->connect('127.0.0.1', 6379);
     $list = $redis->lRange($area, 0, 500);
     if (empty($list)) {
         $local = new medoo();
         $list = $local->select('school', 'name', array('area' => $area));
         unset($local);
     }
     unset($redis);
     return $list;
 }
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:13,代码来源:school_handler.php


示例7: user_login

 /**
  * Verifies user login and logs in
  * returns false if invalid login details
  * else true
  */
 public function user_login($username, $password)
 {
     $db = new medoo($this->config['db']);
     $result = $db->select('users', ['userid', 'password', 'type'], ['username' => $username]);
     if (count($result) == 0) {
         return False;
     }
     if (password_verify($password, $result[0]['password'])) {
         $_SESSION['userid'] = $result[0]['userid'];
         $_SESSION['user_type'] = $result[0]['type'];
         return True;
     }
     return False;
 }
开发者ID:rahulnagurtha,项目名称:Online-Course-Feedback-Portal,代码行数:19,代码来源:login_handler.php


示例8: getResults

 function getResults($text, $index1, $index2)
 {
     include_once "medoo.min.php";
     // Initialize medoo
     $database = new medoo(['database_type' => 'mysql', 'database_name' => 'anecdote_gimme', 'server' => '108.167.140.108', 'username' => 'anecdote_je', 'password' => 'hackChamps']);
     // get the categories
     $cats = $database->select("words", "category_id", ["name" => $text]);
     // select the results from the ids
     $results = array();
     $results[] = $database->select("places", ["name", "address", "telephone", "website", "image", "category_id", "longitude", "latitude"], ["AND" => ["category_id" => $cats], "ORDER" => "description DESC", "LIMIT" => [$index1, $index2]]);
     /*
      * echo "<pre>";
      * print_r($results);
      * echo "</pre>";
      */
     return $results;
     /*
      * $database->select ( "places", [
      * "words" => ["words.category_id" => "places.category_id"],
      * "categories" => ["categories.id" => "words.category_id"]
      * ], [
      * "places.name",
      * "places.address",
      * "places.telephone",
      * "categories.name"
      * ], [
      * "words" => $text
      * ] );
      */
     /*
      * include_once 'mySQL_connection.php';
      *
      * $req = $bdd->prepare ( "SELECT p.name, p.address, p.telephone, c.name
      * FROM places p
      * INNER JOIN words w ON w.category_id = p.category_id
      * INNER JOIN categories c ON c.id = w.category_id
      * WHERE w.name = :word" );
      * $req->execute(array("word" => $text));
      * $data = $req->fetch();
      * $req->closeCursor();
      * return json_encode ( $data );
      */
 }
开发者ID:pgirard-dev,项目名称:Hacksherbrooke2015,代码行数:43,代码来源:Results.php


示例9: get_order_list

 protected function get_order_list()
 {
     $local = new medoo();
     $remote = new maindb();
     $list = $local->select('orders', '*', array('ekey' => $this->key));
     if (!empty($list)) {
         foreach ($list as &$v) {
             $info = $remote->select('p_order', '*', array('id' => $v['order_id']));
             //将unix时间戳转化为日期
             $v['u_time'] = date('Y-m-d H:i:s', $v['u_time']);
             $v['c_time'] = date('Y-m-d H:i:s', $v['c_time']);
             if ($info[0]['did'] > 0) {
                 $v['order_state'] = $this->state['-1'];
             } else {
                 $v['order_state'] = $this->state[$info[0]['state']];
             }
         }
     }
     $this->assign('list', $list);
 }
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:20,代码来源:order_details.php


示例10: __construct

 /**
  * 构造函数
  * @param $component_appid
  * @param $component_appsecret
  * @param $component_verify_ticket
  */
 public function __construct($options)
 {
     $db_config = (require_once '/alidata/www/weixin/framework/config/db.php');
     $wxcachedb_config = $db_config[strtoupper('wxcachedb_config')];
     require_once '/alidata/www/weixin/framework/orm/medoo.php';
     $this->db = medoo::getInstance($wxcachedb_config);
     $this->cache_table_name = 'component';
     $this->component_appid = isset($options['component_appid']) ? $options['component_appid'] : '';
     $this->component_appsecret = isset($options['component_appsecret']) ? $options['component_appsecret'] : '';
     $this->memc = $this->getMemcached();
     $this->prefix = $this->component_appid . '_component_';
     $this->component_access_token = $this->getComponentAccessToken();
 }
开发者ID:jsyzchen,项目名称:wechat-php-sdk,代码行数:19,代码来源:WxComponent.class.php


示例11: function

<?php

$app->get('/admin', function () use($app) {
    global $dbCredentials;
    $database = new medoo($dbCredentials);
    $invoices = $database->select("invoice", ["id", "modified", "currency", "company", "name", "address", "type"], ["ORDER" => "modified DESC"]);
    foreach ($invoices as $id => $invoice) {
        $invoices[$id]['lines'] = $database->select("line", ["id", "description", "charge", "quantity", "is_hours"], ["invoice_id" => $invoice['id'], "ORDER" => "id ASC"]);
    }
    $app->render('admin/admin.html.twig', ['invoices' => $invoices]);
})->setName('home');
开发者ID:scriptist,项目名称:invoice.scripti.st,代码行数:11,代码来源:admin.php


示例12: deletePictureFeed

 /**
  * 删除图片
  * @param bool   $rt
  * @param int    $id
  * @param int    $uid
  * @param \medoo $write_db
  * @return bool
  */
 public function deletePictureFeed($rt, $id, $uid, \medoo $write_db)
 {
     if ($rt !== true || $id < 1 || $uid < 1) {
         return $rt;
     }
     $write_db->delete("feed", ['sid' => "SharePicture_" . $id]);
     if ($write_db === false) {
         Log::write("deletePictureFeed Error", Log::SQL);
         return false;
     }
     return true;
 }
开发者ID:ttym7993,项目名称:Linger,代码行数:20,代码来源:Feed.php


示例13: medoo

<?php

/**
 * Created by PhpStorm.
 * User: zy
 * Date: 2015/11/3
 * Time: 14:06
 */
require_once '../../lib/medoo.php';
// Initialize
$database = new medoo(['database_type' => 'mysql', 'database_name' => 'easycurd', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'charset' => 'utf8']);
$username = $_POST['username'];
$password = $_POST['password'];
echo $password;
echo $username;
$database->select('ec_user', ['name' => 'foo', 'email' => '[email protected]', 'age' => 25, 'lang' => ['en', 'fr', 'jp', 'cn']]);
if ($result = $database) {
    //µÇ¼³É¹¦
    session_start();
    $_SESSION['username'] = $username;
    exit;
} else {
    exit('µÇ¼ʧ°Ü£¡µã»÷´Ë´¦ <a href="javascript:history.back(-1);">·µ»Ø</a> ÖØÊÔ');
}
开发者ID:xdtfinance,项目名称:bond-matching-system,代码行数:24,代码来源:loginAction.php


示例14: ini_set

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
session_start();
require_once 'meedoo.php';
require_once 'config.php';
$root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
$appHome = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/apps/meals/';
$database = new medoo();
$email = $_GET["email"];
$password1 = $_GET["password"];
$password = md5($password1 . $salt);
$profile = $database->get("users", ["name", "password"], ["email" => $email]);
$profile_pw = $profile['password'];
$profile_name = $profile['name'];
if ($password == $profile_pw) {
    $_SESSION['user'] = $email;
    $_SESSION['name'] = $profile_name;
    echo 'good';
} else {
    echo 'bad';
}
开发者ID:ltlam93,项目名称:meals,代码行数:24,代码来源:user-login.php


示例15: session_start

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/1
 * Time: 16:22
 */
//todo,改变meting表中会议状态validity
// todo,inform 中增加一项
//todo,1,attendence中检索meeting id,2,对应状态state设置为0 无效,3,对应user id写成新的notice,4,并将user表中的mes改为当前inform_id
$mid = $_POST['id'];
session_start();
$id = $_SESSION['uid'];
include '../../parameter/Medoo/Resource/medoo.php';
//meeting
$db = new medoo('meetingmanage');
$db->update('meeting', array('VALIDITY' => 1), array('MEETING_ID' => $mid));
//
////inform
$re = $db->select('inform', 'CONTENT', array('MEETING_ID' => 40002));
$content = $re[0];
$new_mes = "注意:关于【" . $content . "】的会议已经取消,请您确认信息!";
$iid = $db->max('inform', 'INFORM_ID');
$iid += 1;
$date = date("Y/m/d");
$db->insert("inform", array('INFORM_ID' => $iid, 'USER_ID' => $id, 'DATE' => $date, 'CONTENT' => $new_mes, 'MEETING_ID' => $mid));
//attendence
//获得user列表
$users = $db->select('attendence', 'USER_ID', array('MEETING_ID' => 40000));
//跟新参会状态
$db->update('attendence', array('STATE' => 0), array('MEETING_ID' => $mid));
开发者ID:keensting,项目名称:MeetingManageSystem,代码行数:30,代码来源:ajax_unsubscribe_meeting.php


示例16: medoo

<?php

require_once 'medoo.php';
$database = new medoo(array('database_type' => 'pgsql', 'database_name' => 'wid', 'server' => 'localhost', 'username' => 'wid_owner', 'password' => 'widowner', 'charset' => 'utf8', 'port' => 5432, 'prefix' => 'wid_schema.'));
$data = $database->select("tblu_storage_view_vt", array('state', 'storage_name', 'city', 'drainage', 'data_provider_name', 'reporting_date', 'today_volume_active', 'today_capacity_active', 'today_proportion_full'), array('ORDER' => array('state ASC', 'storage_name ASC')));
echo '<pre>';
print_r($data);
/*
$database = new medoo(
    array(
        'database_type' => 'pgsql',
        'database_name' => 'dellstore2',
        'server' => 'localhost',
        'username' => 'postgres',
        'password' => 'Jiqiang@1977',
        'charset' => 'utf8',
        'port' => 5432
    )
);

echo '<pre>';
print_r($database->info());


$data1 = $database->select(
    // Table name.
    'cust_hist',
    // Joins.
    array(
        '[><]customers' => 'customerid',
        '[><]products' => 'prod_id',
开发者ID:jiqiang,项目名称:ng-water,代码行数:31,代码来源:rest.php


示例17: ini_set

<?php

ini_set('display_errors', 'ON');
error_reporting(E_ALL);
header("Content-type:text/html;charset=utf-8");
defined('ROOT_PATH') or define('ROOT_PATH', dirname(__FILE__));
include ROOT_PATH . '/../lib/medoo.php';
include ROOT_PATH . '/../lib/Curl.php';
$db = new medoo(array('database_type' => 'mysql', 'database_name' => 'fayuan', 'server' => 'localhost', 'username' => 'root', 'password' => '123456', 'port' => 3306, 'charset' => 'utf8', 'option' => array(PDO::ATTR_CASE => PDO::CASE_NATURAL)));
$curl = new Curl();
$id = 2250;
while ($id <= 1239000) {
    $url = "http://shixin.court.gov.cn/detail?id={$id}";
    $resArr = getHtml($url);
    echo "{$id}\r\n";
    if (is_array($resArr) && !empty($resArr)) {
        //判断数据是否存在
        print_r($resArr);
        $i = $db->insert('shixin', $resArr);
        if ($i <= 0) {
            print_r($db->error());
            die;
        }
    }
    $id++;
}
function getHtml($url)
{
    global $curl;
    $curl->setUrl($url);
    $html = $curl->run();
开发者ID:playgamelxh,项目名称:lxh,代码行数:31,代码来源:shixin.php


示例18: header

<?php

/**
*		获取留言对方姓名
*
*
*/
header("Content-type:text/html; charset=utf8");
$id = $_POST['id'];
include_once './medoo/medoo.php';
$database = new medoo();
$sql = $database->select("user", array("name"), array("id" => $id));
if ($sql) {
    $result['state'] = "success";
    $result['message'] = "成功得到对方姓名";
    $result['info'] = $sql;
    $result_json = json_encode($result);
    echo $result_json;
} else {
    $result['state'] = "error";
    $result['message'] = "获取对方姓名失败";
    $result_json = json_encode($result);
    echo $result_json;
}
开发者ID:a707937337,项目名称:EcjtuOA,代码行数:24,代码来源:manager_name.php


示例19: session_start

<?php

/**
 * Created by PhpStorm.
 * User: wangxiaofeng
 * Date: 11/23/15
 * Time: 9:02 PM
 */
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
date_default_timezone_set("asia/shanghai");
include "../../medoo.php";
include '../../function.php';
$database = new medoo(['database_type' => 'mysql', 'database_name' => 'gongre', 'server' => 'localhost', 'username' => 'root', 'password' => 'xidryhm00', 'charset' => 'utf8', 'port' => 3306, 'option' => [PDO::ATTR_CASE => PDO::CASE_NATURAL]]);
$action = "";
$act = "";
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    $action = htmlspecialchars($_GET["action"]);
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $act = htmlspecialchars($_POST["act"]);
}
if ("login" === $action) {
    $opid = $_GET["username"];
    $pw = $_GET["password"];
    $data = $database->select("gr_op", "*", ["opid" => $opid]);
    if (count($data) > 0) {
        if ($data[0]["pw"] == $pw) {
            $_SESSION["opid"] = $opid;
开发者ID:bluestonemds,项目名称:gongre,代码行数:31,代码来源:Controller.php


示例20: print_r

<?php

//include 'Insertdb2.php';
include "himpdf/mpdf.php";
require 'medoo.php';
require 'config.php';
print_r($_GET);
$txnid = $_GET["txnid"];
$txnid = stripcslashes($txnid);
$database = new medoo(['database_type' => 'mysql', 'database_name' => $dbname, 'server' => $servername, 'username' => $username, 'password' => $dbpassword]);
$datas = $database->select("applicant", "*", ["txnid" => $txnid]);
//print_r($datas);
$message = file_get_contents('confirmaitonmail.php');
$message = str_replace("applicant_uname", $datas[0]['username'], $message);
$message = str_replace("applicant_name", $datas[0]['applicant_name'], $message);
$message = str_replace("applicant_email", $datas[0]['email'], $message);
$message = str_replace("applicant_gname", $datas[0]['gname'], $message);
$message = str_replace("applicant_presentadd", $datas[0]['presentadd'], $message);
$message = str_replace("applicant_permanentadd", $datas[0]['permanentadd'], $message);
$message = str_replace("applicant_phone", $datas[0]['mobile'], $message);
$message = str_replace("applicant_dob", $datas[0]['dob'], $message);
$message = str_replace("applicant_gender", $datas[0]['gender'], $message);
$message = str_replace("applicant_cast", $datas[0]['cast'], $message);
$message = str_replace("applicant_nationality", $datas[0]['nationality'], $message);
$message = str_replace("applicant_postapplying", $datas[0]['postapplying'], $message);
if ($datas[0]['cast'] == gen) {
    $amount = "200";
} else {
    $amount = "100";
}
$message = str_replace("applicant_amount", $amount, $message);
开发者ID:Himadri1800,项目名称:begc-gateway,代码行数:31,代码来源:downloadpdf.php



注:本文中的medoo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP memBuff类代码示例发布时间:2022-05-23
下一篇:
PHP material类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap