当前位置: 首页>>代码示例>>PHP>>正文


PHP getPDO函数代码示例

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


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

示例1: getCommentsForPost

/**
 * Returns the comments for the specified post.
 * @param integer $postId
 * @return array
 */
function getCommentsForPost($postId)
{
    $pdo = getPDO();
    $stmt = $pdo->prepare('SELECT id, name, text, created_at, website FROM comment WHERE post_id = :post_id');
    $stmt->execute(array('post_id' => $postId));
    return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
开发者ID:SanketDG,项目名称:php-blog,代码行数:12,代码来源:common.php

示例2: testInit

function testInit()
{
    $pdo = getPDO('test');
    $pdo->beginTransaction();
    $pdo->query('DELETE FROM CheckinLogs');
    $pdo->commit();
}
开发者ID:shimizu9128,项目名称:nfcCheckin,代码行数:7,代码来源:nfcCheckinMain.php

示例3: getPageByRoute

function getPageByRoute($route) : array
{
    $pdo = getPDO();
    $stmt = $pdo->prepare("SELECT title, content FROM pages WHERE route = :route");
    $stmt->bindParam(":route", $route);
    $stmt->execute();
    return $stmt->fetch();
}
开发者ID:brunowerneck,项目名称:PHPFoundation,代码行数:8,代码来源:functions.php

示例4: renderPage

function renderPage($route)
{
    $page = empty($route) ? 'home' : $route;
    $pdo = getPDO();
    $stmt = $pdo->prepare("SELECT titulo, conteudo FROM Paginas WHERE rota = :route");
    $stmt->bindParam(":route", $route);
    $stmt->execute();
    $pagina = $stmt->fetch();
    require_once __DIR__ . "/Pages/{$page}.php";
}
开发者ID:birah-cursos-code-education,项目名称:FixtureExample,代码行数:10,代码来源:functions.php

示例5: queryOgID

/**
 * Query all the ID of organisms.
 * @return Array
 */
function queryOgID()
{
    $pdo = getPDO();
    try {
        $sql = 'select organismid from reference';
        $ps = $pdo->prepare($sql);
        $ps->execute();
        $ps->setFetchMode(PDO::FETCH_ASSOC);
        $result = $ps->fetchAll();
    } catch (Exception $ex) {
        $error = 'An Error has occurred in data accessing.';
        exit;
    }
    return $result;
}
开发者ID:ycduan,项目名称:UESTC_Software2015,代码行数:19,代码来源:organismDA.php

示例6: session_start

<?php

session_start();
if (!isset($_SESSION["USERID"])) {
    header("Location: logout.php");
    exit;
}
// require_once(dirname(__file__) . '/functions.php');
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$threadSha = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($threadSha["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
updeateToDeleatFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_THREAD_DELEATE_FLAG"]);
updeateToDeleatFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_RES_DELEATE_FLAG"]);
$jsonData = json_encode($threadSha);
header("Content-Type: text/html; X-Content-Type-Options: nosniff; charset=utf-8");
echo $jsonData;
die;
开发者ID:pecodrive,项目名称:stealsystem,代码行数:25,代码来源:deleteajax.php

示例7: dirname

<?php

require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
$queryList = getSQLQuery(getPDO());
$menuList = getMenuListForProcOrder(getPDO(), $queryList["SELECT_MENU_FOR_PROCORDER"]);
$menuData = getProced(getPDO(), $menuList);
$threadList = getThreadListUrl($menuData["menu_url"], getDiFix(getPDO(), "threadListUrlSuffix", $menuData["kind"], $queryList["SELECT_DIFIX"]));
var_dump($menuData);
var_dump(getUa(getPDO(), $queryList["SELECT_UA"]));
var_dump(getHost($menuData["menu_url"]));
$html = threadSteal(getPDO(), "133.130.96.221", "threadSteal", $threadList, $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"]));
var_dump($html);
开发者ID:pecodrive,项目名称:stealsystem,代码行数:12,代码来源:ddddd.php

示例8: setUpBeforeClass

 static function setUpBeforeClass()
 {
     $pdo = self::$pdo = getPDO('test');
 }
开发者ID:shimizu9128,项目名称:nfcCheckin,代码行数:4,代码来源:CheckinLogMapperTest.php

示例9: deleteUserSettingsForDomain

 /**
  * Deletes a user setting domain
  *
  * @param string $userId
  *           User ID
  * @param string $domain
  *           Specific domain of settings i.e. workspace or the settings for a
  *           specific module
  * @throws PDOException
  * @return array array of Properties objects
  */
 public function deleteUserSettingsForDomain($userId, $domain)
 {
     try {
         // Had NotORM issues with this, not sure why so just used PDO (mattg)
         $pdo = getPDO();
         $sql = "DELETE FROM user_settings WHERE `userId` = :userId AND `domain` = :domain";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':userId', $userId, PDO::PARAM_STR);
         $stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:25,代码来源:UserServicePDO.php

示例10: getResArray

            $resData = getResArray(getDiRegex(getPDO(), "resStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, $value["thread_sha"]);
            if (!$resData) {
                continue;
            }
            $ankaerLinkProced = resBodyAnkaerLinkProc($resData, getDiRegex(getPDO(), "resBodyAnkaerLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]));
            if ($menuData["kind"] === "open2ch.net") {
                $imgLinkProced = resBodyImgLinkProcO(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]);
            } else {
                $imgLinkProced = resBodyImgLinkProc(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]);
            }
            $censoredProced = censorShipForRes($imgLinkProced, $censorList);
            // $net_or_sc_kind = kindChecher($censoredProced[0]["res_id"]);
            $net_or_sc_kind = "null";
            $resDataArray = resDataReArray($censoredProced, $net_or_sc_kind, $menuData["kind"]);
            resInsert(getPDO(), $resDataArray, $menuData["kind"], $queryList["INSERT_RES"]);
            threadUpdateTonet_or_sc(getPDO(), $net_or_sc_kind, $value["thread_sha"], $queryList["UPDATE_THREAD_NET_OR_SC"]);
            $countOfResDataArray = count($resDataArray);
            //MAX RES number.
            threadUpdateToRes_end(getPDO(), $value["thread_sha"], $countOfResDataArray, $queryList["UPDATE_THREAD_RES_END"]);
            unset($isoldLog, $resData, $resDataArray, $censoredProced, $imgLinkProced, $ankaerLinkProced, $encodiedResBaseHtml, $resStealBool, $countOfResDataArray, $net_or_sc_kind);
            $i++;
        }
        unset($value, $threadData);
    }
}
memoryPeakUse("end");
timeTest("ProcEnd");
$proc_time = timeView();
procRecode(getPDO(), $menuData["id"], $menuData["menu_title"], $proc_time, $menuData["kind"], $tags["end"], $queryList["INSERT_PROC_RECODE"]);
procUnLocking(getPDO());
开发者ID:pecodrive,项目名称:stealsystem,代码行数:30,代码来源:thread.php

示例11: dirname

<?php

require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
// $encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/l50", $queryList["INSERT_IP_ACCESS"]);
// var_dump($encodiedResBaseHtml);
$encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/", $queryList["INSERT_IP_ACCESS"]);
// $encodiedResBaseHtml = file_get_contents("./imghtml.html");
$resData = getResArray(getDiRegex(getPDO(), "resStealRegex", "open2ch.net", $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, "000000000000000");
$data = resBodyImgLinkProc(getPDO(), $resData, $threadSha, $regexList["ExresBodyImgLinkStealRegex"], $queryList["SELECT_RES"], $fixedList["imgSavePath"], "open2ch.net");
var_dump($data);
// $html = file_get_contents("http://hayabusa.open2ch.net/test/read.cgi/livejupiter/1449141846/l50");
// $regexBase = "/<?[div\sclass=\"imgur]*>?<a.+><img.*data-original=\"(.+)\"\s.+>[<br.>]*<\/a><?[\/div\n]*>?/u";
// $regexImg = "/<img.+data-original=\"(.+)\"\s.+>/u";
// preg_match_all($regexBase, $html, $match, PREG_SET_ORDER);
// $splitArray = [];
//
// foreach ($match as $value) {
//     $splitArray[] = preg_replace("/<\/div>/", "</div>\n", $value);
// }
//
// $imgAllay = [];
// foreach ($splitArray as $value) {
//     preg_match_all($regexBase, $value[0], $imgUrl, PREG_SET_ORDER);
//     $imgAllay[] = $imgUrl;
// }
开发者ID:pecodrive,项目名称:stealsystem,代码行数:31,代码来源:imgtest.php

示例12: dirname

}
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$request = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($request["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
$resData = getResData(getPDO(), $request["thread_sha"], $queryList["SELECT_RES"]);
$sortedResData = sortResByAnkaer($resData);
$threadData = getThreadDataBySha(getPDO(), $request["thread_sha"], $queryList["SELECT_THREAD_BY_THREADSHA"]);
$menuData = getMenuDefaultName(getPDO(), $threadData["menu_id"], $queryList["SELECT_MENU_FOR_MENUID"]);
$html = "";
$resSha = null;
$name = $menuData ? $menuData : "名無しさん";
$countOfSortedResData = count($sortedResData);
for ($k = 0; $k < $countOfSortedResData; $k++) {
    $resMasterID = $sortedResData[0]["res_id"];
    $resSha[] = $sortedResData[$k]["res_sha"];
    $html .= "<span class=\"{$sortedResData[$k]["thread_sha"]} {$sortedResData[$k]["res_sha"]} rename\">";
    $html .= "<span>{$sortedResData[$k]["res_no"]} : </span>";
    $html .= "<span><input type=\"text\" name={$sortedResData[$k]["res_sha"]} size=40 value=\"{$name}\"> : </span>";
    $html .= "<span>{$sortedResData[$k]["res_date"]}</span>";
    $html .= "<span>{$sortedResData[$k]["res_clock"]}</span>";
    if ($sortedResData[$k]["res_id"] === $resMasterID) {
        $html .= "<span class=\"resmaster\">{$sortedResData[$k]["res_id"]}</span>";
    } else {
开发者ID:pecodrive,项目名称:stealsystem,代码行数:31,代码来源:resajax.php

示例13: popTopicEvents

 public function popTopicEvents($userId, $topic)
 {
     try {
         $events = AppUtils::dbToArray($this->db->event_queue()->where("userId=? AND topic=?", $userId, $topic));
         $pdo = getPDO();
         $sql = "DELETE FROM event_queue WHERE `userId` = :userId AND `topic` = :topic";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':userId', $userId, PDO::PARAM_STR);
         $stmt->bindParam(':topic', $topic, PDO::PARAM_STR);
         $stmt->execute();
         return $events;
     } catch (PDOException $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:15,代码来源:EventServicePDO.php

示例14: deleteAllDomain

 /**
  * Delete a setting with specified domain name and setting key
  *
  * @param string $domain
  *           Domain name
  * @throws Exception
  */
 public function deleteAllDomain($domain)
 {
     try {
         $pdo = getPDO();
         $sql = "DELETE FROM system_setting WHERE `domain` = :domainId";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':domainId', $domain, PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:19,代码来源:SettingsServicePDO.php

示例15: session_start

<?php

session_start();
require 'config.php';
require 'password.php';
require 'functions/area.fn.php';
require 'functions/areaPriority.fn.php';
require 'functions/brand.fn.php';
require 'functions/database.fn.php';
require 'functions/priority.fn.php';
require 'functions/priorityTheme.fn.php';
require 'functions/theme.fn.php';
require 'functions/user.fn.php';
$db = getPDO($database);
开发者ID:RGLong,项目名称:draft_kosmes,代码行数:14,代码来源:autoload.php


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