当前位置: 首页>>代码示例>>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;未经允许,请勿转载。