本文整理汇总了PHP中MC函数的典型用法代码示例。如果您正苦于以下问题:PHP MC函数的具体用法?PHP MC怎么用?PHP MC使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doCurlPostRequest
/**
* 封装curl的调用接口,post的请求方式
* @return array()
*/
protected function doCurlPostRequest($privatePara, $isDES, $timeout = 15, $url = "", $isCache = true)
{
$url = self::$url;
$requestString = $this->getApiHeaderPara();
$requestString = $requestString . $privatePara;
if ($url == "" || $requestString == "" || $timeout <= 0) {
return false;
}
$isCache = $isCache && $this->cacheTimeLength() > 0;
if ($isCache) {
$mc = MC();
$mk_d = self::$act . "_" . md5($privatePara);
$mk_t = $mk_d . "_lasttime2";
if ($mc->get($mk_t)) {
$data = $mc->get($mk_d);
if ($data) {
return $data;
}
} else {
$mc->set2($mk_t, "1", $this->cacheTimeLength());
}
}
$data = $this->post($url, $requestString);
if ($isDES) {
$data = MyDes::share()->decode($data, self::$key);
}
if ($isCache) {
//数据最长保存一小时(实际缓存时间为$mk_t的缓存时间)
$mc->set($mk_d, $data, 60 * 60);
}
return $data;
}
示例2: __construct
public function __construct()
{
if (!MC('User')->checkAccessToEditGpc(me())) {
goU('main');
}
$this->_action_list = array('rename' => L('wizard.gpc_rename_attribute_action'), 'edit' => L('wizard.gpc_edit_attribute_action'), 'add' => L('wizard.gpc_add_attribute_action'), 'delete' => L('wizard.gpc_delete_attribute_action'));
}
示例3: init
public function init(RM_List_Object $list)
{
$this->_list = $list;
$this->addItem(array('img' => '/img/report_settings.gif', 'alt' => L('menu.main.user_sort', array('menu_name' => L($list->menuCaption()))), 'url' => '#', 'extra' => ' onclick="getSortUser(\'' . $list->id() . '\');" '));
$this->addSeparator();
if ($this->_list->excelAvailable() && MC('List')->canLoadToExcel($list->id())) {
$url = @$_SERVER['SERVER_PORT'] == 443 ? U('report.https_excel') : U('report.excel');
$url .= '?' . $_SERVER['QUERY_STRING'];
$this->addItem(array('url' => $url, 'img' => '/img/toexcel.gif', 'alt' => L('report.toexcel')));
if (!$list->mailingAvailable()) {
$this->addSeparator();
}
}
if ($list->mailingAvailable()) {
$q['mailing'] = 1;
$url = url($q, 'abs');
$this->addItem(array('url' => $url, 'img' => '/img/plan.gif', 'alt' => L('report.mailing')));
$this->addSeparator();
}
$this->addButtonNoFilter(array('alt' => L('report.reset_filter'), 'extra' => 'onclick="clearForm(\'filterForm\'); return false;"'));
$this->addButtonFilter(array('alt' => L('report.filter'), 'extra' => 'onclick="startSearch(); return false;"'));
if ($this->_list->edit_script) {
if (count($this->_toHtml) > 4) {
$this->addSeparator();
}
$this->addItem(array('img' => '/img/save.gif', 'alt' => L('common.save'), 'extra' => 'class="edit_script"'));
}
}
示例4: decorator
/**
* Description...
*
* @return void
**/
public function decorator($reportId)
{
if (!$this->_decorator) {
$libName = M('List')->decoratorName($reportId);
$this->_decorator = $libName ? MC($libName) : MC('Report_Blank');
}
return $this->_decorator;
}
示例5: getFlavoursForSelectedBrick
public function getFlavoursForSelectedBrick(RM_Wizard_Result_Object $obResult, $flavour_type)
{
$obBrick = MC('Gpc_Wizard_Flavour_Main')->getSelectedBrick($obResult);
$arr = array();
foreach ($obBrick->getFlavours($flavour_type) as $obFlavour) {
$arr[$obFlavour->id()] = $obFlavour->getName();
}
return $arr;
}
示例6: getLoginUser
static function getLoginUser()
{
$str = get_cookie(getC('LOGIN_KEY'));
$arr = explode("###", $str);
$mc = MC();
$mk = getC('LOGIN_KEY') . "_" . $arr[0];
$obj = $mc->get($mk);
if ($str && $obj->SIMULATION_LOGIN_STR == $str) {
return $obj;
}
return null;
}
示例7: countAgain
public function countAgain()
{
$barcode = MC('AveragePrice')->getBarcodeValue();
$obQuery = MC('AveragePrice')->getQuery($barcode);
if ($this->getSigma() > $this->max) {
$obQuery->where('p.price/p.quantity < ?', $this->getSigma(1));
}
if ($this->getSigma() < $this->min) {
$obQuery->where('p.price/p.quantity > ?', $this->getSigma(-1));
}
$obQuery->where('b.product_qty = ? AND b.product_measure = ? ', $this->qty, $this->measure);
return iterFirst($obQuery->execute());
}
示例8: getAdditionalParams
/**
* Returns additional params (query object, column etc.) for report
*
* @param array args
* @return array
**/
public function getAdditionalParams($args)
{
$args['query'] = M('Barcode')->report()->barcodeListQuery(TRUE);
if (!MC('User')->canDeleteBarcode(me())) {
$args['no_visible'][] = 'delete';
}
if (!MC('User')->canSetIsFood(me())) {
$args['no_visible'][] = 'is_food';
}
if (!MC('User')->canSendBarcodeToRefresh(me())) {
$args['no_visible'][] = 'to_refresh';
}
return $args;
}
示例9: approveQueue
public function approveQueue(RM_Barcode_Queue $obQueue, $name_new)
{
$obQueue->moderated = 1;
$obQueue->name_new = $name_new;
$obQueue->user_id_moderator = me()->id();
if (isNull($obBarcode = M('Barcode')->loadBarcodeByValue($obQueue->barcode_value))) {
$obBarcode = M('Barcode')->createBarcode(array('value' => $obQueue->barcode_value, 'attribute_1' => $name_new, 'complete' => 0));
} else {
$obBarcode->value = $obQueue->barcode_value;
$obBarcode->attribute_1 = $name_new;
}
$error = '';
if (!MC('Barcode')->save($obBarcode, $error)) {
error(L($error));
} else {
$obQueue->save();
}
}
示例10: load_class
static function load_class($class)
{
$cachetime = getC("AUTO_LOAD_CACHETIME");
if ($cachetime > 0 && !in_array($class, array("MyCache"))) {
$m = MC();
$mk = md5(getC("APP_PATH")) . "_" . $class;
$mget = $m->get($mk);
if ($mget) {
if (file_exists($mget)) {
require_once "{$mget}";
return;
} else {
$m->delete($mk);
}
}
}
$arr = getC("AUTO_LOAD_PATH");
$classFullPath = null;
foreach ($arr as $path) {
$file1 = $path . "/" . "{$class}.class.php";
//my_log($file1);
if (file_exists($file1)) {
$classFullPath = $file1;
break;
}
$file2 = $path . "/" . "class.{$class}.php";
if (file_exists($file2)) {
$classFullPath = $file2;
break;
}
}
if ($cachetime > 0 && $m && $classFullPath) {
$m->set($mk, $classFullPath, $cachetime);
}
require_once "{$classFullPath}";
}
示例11: array
if (!isset($_REQUEST['brick_id'])) {
$error = 'please_specify_brick';
} else {
if (isNull($obBrick = M('Gpc')->loadBrickById($_REQUEST['brick_id']))) {
$error = 'no_such_brick';
}
}
}
}
if (!@$error) {
$root_params = array('object_type' => 'attribute') + $obAttribute->props();
/* $root_params = array(
'object_type' => 'attribute',
'slave_id' => $obAttribute->id(),
);*/
// выбрать все `мастер` атрибуты данного атрибута с учетом брика
$list = $obAttribute->getMasters($obBrick);
}
}
$root_params['status'] = 'ok';
$root_params['list'] = 'master';
$root_params = array_merge($root_params, MC('Message')->setXmlMessage(@$error, @$message, 'gpc'));
// сформировать и вывести XML
$root = M('Ajax')->init('gpc', $root_params);
if (@$list) {
$fields = M('Gpc')->fields('attribute');
$map = array_keys($fields);
$map = $map + qw2('master_value_id>master_value_id');
$root->addNode('attribute', $list, $map);
}
M('Ajax')->xml();
示例12: columns
/**
* Retrieves column meta data for the specified table.
*
* @param string $table Name of a table
* @return array An array of {@link Column} objects.
*/
public function columns($table)
{
/**
* DIY 添加缓存
*/
$cacheKey = "db:column:{$table}";
$structs = \MC($cacheKey);
if (empty($structs)) {
$sth = $this->query_column_info($table);
$structs = $sth->fetchAll();
\MC($cacheKey, $structs, 600);
}
$columns = array();
foreach ($structs as $row) {
$c = $this->create_column($row);
$columns[$c->name] = $c;
}
return $columns;
}
示例13: Cache
include "../../framework.php";
Core::getInstance();
//初始化缓存,memcache类
$memc_obj = new Cache(C('CACHEGROUP'));
$act = isset($_GET['action']) ? $_GET['action'] : "";
$v = isset($_GET['v']) ? $_GET['v'] : "1.0";
if (empty($act)) {
json_return(10170);
}
if (preg_match("/^[a-z0-9_]*\$/i", $act) == 0) {
json_return(10171, '', $act);
}
if (preg_match("/^[\\.0-9_]*\$/i", $v) == 0) {
json_return(10175, '', $v);
}
$data = MC("SELECT * FROM " . C('DB_PREFIX') . "interface_version WHERE requestname='{$act}' AND version='{$v}' AND is_delete=0", 0);
if (!isset($data[0]['is_disable'])) {
json_return(10173, '', $act, $v);
}
if ($data[0]['is_disable'] == 1) {
json_return(10174, '', $act, $v);
}
//对接口请求内容进行验证或转换
$transform = !empty($data[0]['extend_transform']) ? $data[0]['extend_transform'] : 'Transform:commonTransform';
list($vclass, $vfun) = explode(':', $transform);
$vmethod = ucfirst($vclass . "Act");
$vfun = 'act_' . $vfun;
if (!class_exists($vmethod)) {
json_return(10176);
}
if (!method_exists($vmethod, $vfun)) {
示例14: getRowHighlight
/**
* Description...
*
* @return void
**/
public function getRowHighlight(RM_List_Row $row)
{
$obLeave = M('User')->loadLeaveById($row->id);
return MC('Leave')->getHighlight($obLeave);
}
示例15: MC
<?php
require_once "../../init.php";
MC('Report_Payment')->generateReport();