當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRUD::obtain方法代碼示例

本文整理匯總了PHP中CRUD::obtain方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRUD::obtain方法的具體用法?PHP CRUD::obtain怎麽用?PHP CRUD::obtain使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRUD的用法示例。


在下文中一共展示了CRUD::obtain方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_rating

 public function get_rating($productID)
 {
     $sql = '
     SELECT DISTINCT AVG(rating) AS  customers_rating , COUNT(*) AS customer_votes
     FROM ' . REVIEWS_TABLE . '
     WHERE productID = ' . $productID . ' AND approve=1';
     $c = CRUD::obtain();
     $result = $c->query($sql);
     return $result[0];
 }
開發者ID:gblok,項目名稱:rsc,代碼行數:10,代碼來源:class.rvs.php

示例2: xStripSlashesGPC

$_GET = xStripSlashesGPC($_GET);
$_COOKIE = xStripSlashesGPC($_COOKIE);
db_connect(DB_HOST, DB_USER, DB_PASS) or die(ERROR_DB_INIT);
db_select_db(DB_NAME) or die(db_error());
settingDefineConstants();
// Friendly URLs module
//include('url_rewriter.php');
$alias = new Router();
//     $alias->import (Alias::MODULE_PAGE);
//     $alias->import (Alias::MODULE_CATEGORY);
//     $alias->import (Alias::MODULE_PRODUCT);
//$alias->generate_query();
include "core/config/headers.php";
include "core/config/error_handler.php";
//CRUD
$crud = CRUD::obtain('localhost', DB_USER, DB_PASS, DB_NAME);
function set_cookie($Name, $Value = '', $Expires = '', $Secure = false, $Path = '', $Domain = '', $HTTPOnly = false)
{
    header('Set-Cookie: ' . rawurlencode($Name) . '=' . rawurlencode($Value) . (empty($Expires) ? '' : '; expires=' . gmdate('D, d-M-Y H:i:s', $Expires) . ' GMT') . (empty($Path) ? '' : '; path=' . $Path) . (empty($Domain) ? '' : '; domain=' . $Domain) . (!$Secure ? '' : '; secure') . (!$HTTPOnly ? '' : '; HttpOnly'), false);
}
# стартуем сессию
define("SECURITY_EXPIRE", 60 * 60 * CONF_SECURITY_EXPIRE);
session_set_save_handler("sess_open", "sess_close", "sess_read", "sess_write", "sess_destroy", "sess_gc");
session_start();
# посылаем cookie сессии
if (isset($_COOKIE['PHPSESSID'])) {
    if (SECURITY_EXPIRE > 0) {
        set_cookie('PHPSESSID', $_COOKIE['PHPSESSID'], time() + SECURITY_EXPIRE);
    } else {
        set_cookie('PHPSESSID', $_COOKIE['PHPSESSID']);
    }
開發者ID:gblok,項目名稱:rsc,代碼行數:31,代碼來源:index.php


注:本文中的CRUD::obtain方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。