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


PHP C函數代碼示例

本文整理匯總了PHP中C函數的典型用法代碼示例。如果您正苦於以下問題:PHP C函數的具體用法?PHP C怎麽用?PHP C使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: __construct

 public function __construct()
 {
     parent::__construct();
     Tpl::setLayout('store_joinin_layout');
     $this->checkLogin();
     $model_seller = Model('seller');
     $seller_info = $model_seller->getSellerInfo(array('member_id' => $_SESSION['member_id']));
     if (!empty($seller_info)) {
         @header('location: index.php?act=seller_login');
     }
     if ($_GET['op'] != 'check_seller_name_exist' && $_GET['op'] != 'checkname') {
         $this->check_joinin_state();
     }
     $phone_array = explode(',', C('site_phone'));
     Tpl::output('phone_array', $phone_array);
     $model_help = Model('help');
     $condition = array();
     $condition['type_id'] = '99';
     //默認顯示入駐流程;
     $list = $model_help->getShowStoreHelpList($condition);
     Tpl::output('list', $list);
     //左側幫助類型及幫助
     Tpl::output('show_sign', 'joinin');
     Tpl::output('html_title', C('site_name') . ' - ' . '商家入駐');
     Tpl::output('article_list', '');
     //底部不顯示文章分類
 }
開發者ID:dotku,項目名稱:shopnc_cnnewyork,代碼行數:27,代碼來源:store_joinin.php

示例2: index

 /**
  * 後台菜單首頁
  * @return none
  */
 public function index()
 {
     $pid = I('get.pid', 0);
     if ($pid) {
         $data = D('Menu')->where("id={$pid}")->field(true)->find();
         $this->assign('data', $data);
     }
     $title = trim(I('get.title'));
     $type = C('CONFIG_GROUP_LIST');
     $all_menu = D('Menu')->getField('id,title');
     $map['pid'] = $pid;
     if ($title) {
         $map['title'] = array('like', "%{$title}%");
     }
     $list = D("Menu")->where($map)->field(true)->order('sort asc,id asc')->select();
     int_to_string($list, array('hide' => array(1 => L('_YES_'), 0 => L('_NOT_')), 'is_dev' => array(1 => L('_YES_'), 0 => L('_NOT_'))));
     if ($list) {
         foreach ($list as &$key) {
             if ($key['pid']) {
                 $key['up_title'] = $all_menu[$key['pid']];
             }
         }
         $this->assign('list', $list);
     }
     // 記錄當前列表頁的cookie
     Cookie('__forward__', $_SERVER['REQUEST_URI']);
     $this->meta_title = L('_MENU_LIST_');
     $this->display();
 }
開發者ID:terrydeng,項目名稱:beimeibang1205,代碼行數:33,代碼來源:MenuController.class.php

示例3: do_personal_index

 /**
  * 我的兌換 do_personal_index
  */
 public function do_personal_index()
 {
     /* 初始化變量 */
     $user_id = I('get.user_id');
     $page_num = I('get.page_num');
     $page_num = empty($page_num) || $page_num < 0 ? 1 : $page_num;
     /* 查詢條件 */
     $field = 'pay_order.trade_no,pay_order.shop_coupon_info,pay_order.shop_id,pay_order.trade_state,shop.title as shop_title';
     $where['pay_order.user_id'] = array('EQ', $user_id);
     $where['pay_order.display'] = array('EQ', 1);
     $order = 'pay_order.id desc';
     /* 查詢數據 */
     $list = $this->alias('pay_order')->field($field)->where($where)->join('LEFT JOIN __SHOP__ shop on pay_order.shop_id = shop.id')->order($order)->limit(C('PAGE_NUM'))->page($page_num)->select();
     foreach ($list as $k => $v) {
         $shop_coupon_info = json_decode($v['shop_coupon_info'], true);
         $list[$k]['coupon_id'] = $shop_coupon_info['id'];
         $list[$k]['coupon_title'] = $shop_coupon_info['title'];
         if ($shop_coupon_info['coupon_type'] == 1) {
             $list[$k]['coupon_tag'] = strval(0);
         } else {
             $list[$k]['coupon_tag'] = $shop_coupon_info['coupon_worth'];
         }
         $list[$k]['coupon_content'] = $shop_coupon_info['content'];
         unset($list[$k]['shop_coupon_info']);
         /* 過濾數據 */
         if (!empty($v['coupon_title'])) {
             $list[$k]['coupon_title'] = htmlspecialchars_decode($v['coupon_title']);
         }
     }
     /* 讀取json */
     $list = empty($list) ? array() : $list;
     $jsonInfo['list'] = arr_content_replace($list);
     return $jsonInfo;
 }
開發者ID:liqihua,項目名稱:yanzhihui,代碼行數:37,代碼來源:PayOrderModel.class.php

示例4: test_newslist

 public function test_newslist()
 {
     $urlbase = C("HTTP_HOST") . "/app/movie/newslist";
     //驗證用戶ID
     $this->assert_is_true(send_get_success($urlbase));
     //id為空
     $this->assert(40002, send_get($urlbase . "?id=d")->errcode);
     //id非整數
     $this->assert_is_true(send_get_success($urlbase . "?id=1"));
     //id為整數
     //驗證mfields字符串
     $this->assert(40099, send_get($urlbase . "?mfields=id,name22,alias")->errcode);
     $this->assert(40099, send_get($urlbase . "?id=1&mfields=id,name22,alias")->errcode);
     $this->assert_is_true(send_get_success($urlbase . "?id=1&mfields=id,alias"));
     $this->assert_is_true(send_get_success($urlbase . "?id=1&mfields=id,mname,alias"));
     //驗證nfields字符串
     $this->assert(40099, send_get($urlbase . "?id=1&nfields=id,title22,content")->errcode);
     $this->assert_is_true(send_get_success($urlbase . "?id=1&nfields=id,content"));
     $this->assert_is_true(send_get_success($urlbase . "?id=1&nfields=id,title,content"));
     //驗證分頁
     $this->assert(40002, send_get($urlbase . '?pager={"limit":2,dd"page":1,"order":"id desc"}')->errcode);
     //pager參數不合法
     //$this->assert(40002,send_get($urlbase.'?pager={"limit":2,dd"page":1,"order":"id desc"}')->errcode);//pager參數排序不合法
     $this->assert_is_true(send_get_success($urlbase . '?pager={"limit":2,"page":1,"order":"id%20desc"}'));
     //合法的pager
 }
開發者ID:Emon0526,項目名稱:zhuoying-wx,代碼行數:26,代碼來源:MovieController.class.php

示例5: connect

 /**
 +----------------------------------------------------------
 * 連接數據庫方法
 +----------------------------------------------------------
 * @access public 
 +----------------------------------------------------------
 * @throws ThinkExecption
 +----------------------------------------------------------
 */
 public function connect($config = '', $linkNum = 0)
 {
     if (!isset($this->linkID[$linkNum])) {
         if (empty($config)) {
             $config = $this->config;
         }
         $conn = $this->pconnect ? 'mysql_pconnect' : 'mysql_connect';
         $this->linkID[$linkNum] = $conn($config['hostname'] . ':' . $config['hostport'], $config['username'], $config['password']);
         if (!$this->linkID[$linkNum]) {
             throw_exception(mysql_error());
             return False;
         }
         if (!mysql_select_db($config['database'], $this->linkID[$linkNum])) {
             throw_exception($this->error());
             return False;
         }
         $this->dbVersion = mysql_get_server_info($this->linkID[$linkNum]);
         if ($this->dbVersion >= "4.1") {
             //使用UTF8存取數據庫 需要mysql 4.1.0以上支持
             mysql_query("SET NAMES '" . C('DB_CHARSET') . "'", $this->linkID[$linkNum]);
         }
         // 標記連接成功
         $this->connected = true;
         // 注銷數據庫連接配置信息
         if (1 != C('DB_DEPLOY_TYPE')) {
             unset($this->config);
         }
     }
     return $this->linkID[$linkNum];
 }
開發者ID:skiman100,項目名稱:thinksns,代碼行數:39,代碼來源:DbMysql.class.php

示例6: __construct

 function __construct()
 {
     $this->APPID = C('APPID');
     $this->SECRET = C('APPSECRET');
     $this->api_url = C('WEIXIN_API_URL');
     $this->access_token = $this->getToken();
 }
開發者ID:qinzhi,項目名稱:taoj,代碼行數:7,代碼來源:WeChatApi.class.php

示例7: co_star_edit

 public function co_star_edit()
 {
     if ($_POST['submit'] and $_POST['index'] != "") {
         $Stars = M('Co_stars');
         $index = $_POST['index'];
         $star = $Stars->where('photo_index=' . $index)->find();
         if ($_POST['title'] != "") {
             $data['photo_title'] = $_POST['title'];
         }
         $tmp_name = $_FILES['upfile']['tmp_name'];
         $file = $_FILES["upfile"];
         //上傳文件名稱
         //C('__PUBLIC__')爲 /Quanquan/Public
         move_uploaded_file($tmp_name, 'Public/WebResources/co_star/' . $file['name']);
         //將上傳文件移動到指定目錄待解壓
         if ($file['name']) {
             unlink($star['photo_url']);
             $data['photo_url'] = C('__PUBLIC__') . '/WebResources/co_star/' . $file['name'];
         }
         if ($Stars->where('photo_index=' . $index)->save($data)) {
             echo '修改成功';
         } else {
             echo $star['photo_url'];
         }
     } else {
         echo '未輸入數據';
     }
     $this->display();
 }
開發者ID:224-lab,項目名稱:Quanquan,代碼行數:29,代碼來源:MoreController.class.php

示例8: index

 public function index()
 {
     $sysinfo = M('sys')->order('id asc')->find();
     $this->assign('sys', $sysinfo);
     $appid = $sysinfo['web_appid'];
     $appsecret = $sysinfo['web_appsecret'];
     if (!defined('VIRIFY')) {
         virifylocal();
     }
     $_scene = M('scene');
     $where['scenecode_varchar'] = I('get.id', 0);
     $where['delete_int'] = 0;
     $_scene_list = $_scene->where($where)->select();
     // print_r($_scene_list); exit('dddd');
     $sysinfo = M('sys')->order('id asc')->find();
     if ($sysinfo['is_user_anli_shenghe'] && !isset($_GET['preview'])) {
         if ($_scene_list[0]["shenhe"] != 1) {
             $this->error('抱歉,您的場景還沒通過管理員審核', '/#/main');
         }
     }
     $argu2 = array();
     $argu2['title'] = $_scene_list[0]["scenename_varchar"];
     $argu2['url'] = C('IS_OPEN_STATIC') ? 'v-' . $_scene_list[0]["scenecode_varchar"] : 'index.php?c=view&id=' . $_scene_list[0]["scenecode_varchar"];
     $argu2['desc'] = $_scene_list[0]["desc_varchar"];
     $argu2['imgsrc'] = $_scene_list[0]["thumbnail_varchar"];
     $this->assign("confinfo2", $argu2);
     $mydd = get_client_ip();
     if ($mydd !== '127.0.0.1') {
         $confinfo = $this->get_js_sdk($appid, $appsecret);
     }
     $this->assign("confinfo", $confinfo);
     $this->display(HTML_VESION);
 }
開發者ID:sdgdsffdsfff,項目名稱:html5Editor,代碼行數:33,代碼來源:ViewController.class.php

示例9: get_run_link

 public function get_run_link($id)
 {
     static $des;
     $des = empty($des) ? new \Common\ORG\DES(C('API_DATA_CRYPT_KEY')) : $des;
     $item = $this->find($id);
     $item_data = $this->get_item_data($id, true);
     $service_db = D('Service');
     $service = $service_db->find($item['sid']);
     $item_data_field = array_keys($item_data);
     foreach ($item_data_field as $key => $var) {
         $item_data_field[$key] = '{' . $var . '}';
     }
     $item_data_value = array_values($item_data);
     $service_db = D('Service');
     $service = $service_db->find($item['sid']);
     $environment_db = D('Environment');
     $eid = $environment_db->get_current_environment();
     $link = [];
     $link_tpl = '[protocol]://[type]/[path](des)/[parameter](des)/[attach](des)/';
     $replace['[protocol]'] = C('API_PROTOCOL');
     $replace['[type]'] = $service['protocol'];
     $replace['[path](des)'] = '';
     $replace['[parameter](des)'] = '';
     $replace['[attach](des)'] = '';
     $soft = D('Soft')->get_soft($item['sid'], $eid);
     foreach ($soft as $var) {
         $replace['[parameter](des)'] = $des->encrypt(str_replace($item_data_field, $item_data_value, $var['tpl']));
         $replace['[path](des)'] = $des->encrypt($var['path']);
         $replace['[attach](des)'] = $des->encrypt('pathid-' . $var['pathid'] . ',item-' . $item['id'] . ',user-' . session("admin_username"));
         $link[] = array('name' => $var['name'], 'link' => str_replace(array_keys($replace), array_values($replace), $link_tpl));
     }
     return $link;
 }
開發者ID:baiy,項目名稱:login,代碼行數:33,代碼來源:ItemModel.class.php

示例10: isLogin

 protected function isLogin()
 {
     if (empty($_SESSION[APP_NAME . '_USERINFO'])) {
         /* session 不存在,檢查cookie */
         if (!empty($_COOKIE['ECTOUCHCP']['ADMIN_ID']) && !empty($_COOKIE['ECTOUCHCP']['ADMIN_PWD'])) {
             // 找到了cookie, 驗證cookie信息
             $condition['user_id'] = intval($_COOKIE['ECTOUCHCP']['ADMIN_ID']);
             $userInfo = $this->model->table('admin_user')->field('user_id, user_name, password, email, last_login, ec_salt')->where($condition)->find();
             if (empty($userInfo)) {
                 // 沒有找到這個記錄
                 setcookie($_COOKIE['ECTOUCHCP']['ADMIN_ID'], '', 1);
                 setcookie($_COOKIE['ECTOUCHCP']['ADMIN_PWD'], '', 1);
                 return false;
             } else {
                 // 檢查密碼是否正確
                 if (md5(md5($userInfo['user_id'] . $userInfo['user_name']) . C('hash_code')) == $_COOKIE['ECTOUCHCP']['ADMIN_PWD']) {
                     $this->setLogin($userInfo);
                     $data['last_login'] = gmtime();
                     $data['last_ip'] = get_client_ip();
                     $this->model->table('admin_user')->data($data)->where($condition)->update();
                     $this->userInfo = $_SESSION[APP_NAME . '_USERINFO'];
                     return true;
                 } else {
                     setcookie($_COOKIE['ECTOUCHCP']['ADMIN_ID'], '', 1);
                     setcookie($_COOKIE['ECTOUCHCP']['ADMIN_PWD'], '', 1);
                     return false;
                 }
             }
         }
         return false;
     } else {
         $this->userInfo = $_SESSION[APP_NAME . '_USERINFO'];
         return true;
     }
 }
開發者ID:noikiy,項目名稱:shop-3,代碼行數:35,代碼來源:AdminController.class.php

示例11: index

 public function index()
 {
     if (!session('openid_' . $this->token)) {
         $this->info = M('wxuser')->where(array('token' => $this->token))->find();
         vendor("Oauth2.OAuth2", LIB_PATH . '../Extend/Vendor');
         vendor("Oauth2.Provider.Wechat", LIB_PATH . '../Extend/Vendor');
         $wechat = new Wechat();
         $wechat->config(array('id' => $this->info['appid'], 'secret' => $this->info['appsecret']));
         $redirect_uri = C('site_url') . '/index.php/Wap/Coupons/index?token=' . $this->token . '&coupon_id=' . $this->coupon_id;
         if (!$_GET['code']) {
             // By sending no options it'll come back here
             $url = $wechat->authorize(array('redirect_uri' => $redirect_uri));
             redirect($url);
         } else {
             try {
                 // Have a go at creating an access token from the code
                 $token = $wechat->access($_GET['code'], array('redirect_uri' => $redirect_uri));
                 // Use this object to try and get some user details (username, full name, etc)
                 $user = $wechat->get_user_info($token);
                 $this->openid = $user->openid;
                 session('openid_' . $this->token, $user->openid);
             } catch (OAuth2_Exception $e) {
                 print_r($e);
                 die;
             }
         }
     } else {
         $this->openid = session('openid_' . $this->token);
     }
     $url = C('site_url') . "/index.php?g=Wap&m=Coupon&a=index&type=1&token=" . $this->token . '&id=' . $this->coupon_id . '&wecha_id=' . $this->openid;
     header('Location:' . $url);
 }
開發者ID:zhaoshengloveqingqing,項目名稱:Wechat,代碼行數:32,代碼來源:CouponsAction.class.php

示例12: factory

 public static function factory($options)
 {
     $options = is_array($options) ? $options : array();
     //隻實例化一個對象
     if (is_null(self::$cacheFactory)) {
         self::$cacheFactory = new cacheFactory();
     }
     $driver = isset($options['driver']) ? $options['driver'] : C("CACHE_TYPE");
     //靜態緩存實例名稱
     $driverName = md5_s($options);
     //對象實例存在
     if (isset(self::$cacheFactory->cacheList[$driverName])) {
         return self::$cacheFactory->cacheList[$driverName];
     }
     $class = 'Cache' . ucwords(strtolower($driver));
     //緩存驅動
     $classFile = YY_PATH . 'Cache/' . $class . '.class.php';
     //加載驅動類庫文件
     if (!require_array($classFile)) {
         halt("緩存類型指定錯誤,不存在緩存驅動文件:" . $classFile);
     }
     $cacheObj = new $class($options);
     self::$cacheFactory->cacheList[$driverName] = $cacheObj;
     return self::$cacheFactory->cacheList[$driverName];
 }
開發者ID:kumfo,項目名稱:YYphp,代碼行數:25,代碼來源:CacheFactory.class.php

示例13: uploadPic

 /**
  * 上傳圖片
  */
 public function uploadPic()
 {
     $config = array('maxSize' => 0, 'exts' => array('jpg', 'png', 'gif', 'jpeg'), 'rootPath' => './Upload/', 'driver' => 'LOCAL', 'subName' => array('date', 'Y-m'), 'savePath' => I('dir', 'uploads') . "/");
     $upload = new \Think\Upload($config);
     $rs = $upload->upload($_FILES);
     if (!$rs) {
         $this->error($upload->getError());
     } else {
         $images = new \Think\Image();
         $images->open('./Upload/' . $rs['Filedata']['savepath'] . $rs['Filedata']['savename']);
         $newsavename = str_replace('.', '_thumb.', $rs['Filedata']['savename']);
         $vv = $images->thumb(I('width', 300), I('height', 300), I('thumb_type', 1))->save('./Upload/' . $rs['Filedata']['savepath'] . $newsavename);
         if (C('RTC_M_IMG_SUFFIX') != '') {
             $msuffix = C('RTC_M_IMG_SUFFIX');
             $mnewsavename = str_replace('.', $msuffix . '.', $rs[$Filedata]['savename']);
             $mnewsavename_thmb = str_replace('.', "_thumb" . $msuffix . '.', $rs[$Filedata]['savename']);
             $images->open('./Upload/' . $rs[$Filedata]['savepath'] . $rs[$Filedata]['savename']);
             $images->thumb(I('width', 700), I('height', 700))->save('./Upload/' . $rs[$Filedata]['savepath'] . $mnewsavename);
             $images->thumb(I('width', 250), I('height', 250))->save('./Upload/' . $rs[$Filedata]['savepath'] . $mnewsavename_thmb);
         }
         $rs['Filedata']['savepath'] = "Upload/" . $rs['Filedata']['savepath'];
         $rs['Filedata']['savethumbname'] = $newsavename;
         $rs['status'] = 1;
         echo json_encode($rs);
     }
 }
開發者ID:Jitlee,項目名稱:CKY,代碼行數:29,代碼來源:BaseAction.class.php

示例14: register

 public function register($username = '', $password = '', $repassword = '', $email = '', $verify = '')
 {
     if (!C('USER_ALLOW_REGISTER')) {
         $this->error('注冊已關閉');
     }
     if (IS_POST) {
         //注冊用戶
         /* 檢測驗證碼 */
         if (!check_verify($verify)) {
             $this->error('驗證碼輸入錯誤!');
         }
         /* 檢測密碼 */
         if ($password != $repassword) {
             $this->error('密碼和重複密碼不一致!');
         }
         /* 調用注冊接口注冊用戶 */
         $User = new UserApi();
         $uid = $User->register($username, $password, $email);
         if (0 < $uid) {
             //注冊成功
             //TODO: 發送驗證郵件
             $this->success('注冊成功!', U('login'));
         } else {
             //注冊失敗,顯示錯誤信息
             $this->error($this->showRegError($uid));
         }
     } else {
         //顯示注冊表單
         $this->display();
     }
 }
開發者ID:chujieyang,項目名稱:OneThinkFramework,代碼行數:31,代碼來源:UserController.class.php

示例15: insert

 public function insert()
 {
     C('TOKEN_ON', false);
     $db = D('Call');
     $where['uid'] = $_SESSION['uid'];
     $where['token'] = $_SESSION['token'];
     $res = $db->where($where)->find();
     if ($res == false) {
         $where['phone_account'] = $this->_post('phone_account', 'trim');
         if (isset($_POST['phone_password'])) {
             $where['phone_password'] = $this->_post('phone_password', 'trim');
         }
         if ($where['phone_account'] == false) {
             $this->error('標題必須填寫');
         }
         $id = $db->data($where)->add();
         if ($id) {
             $this->success('添加成功', U('Call/index'));
         } else {
             $this->error('添加失敗', U('Call/index'));
         }
     } else {
         $where['id'] = $res['id'];
         $where['phone_account'] = $this->_post('phone_account', 'trim');
         if (isset($_POST['phone_password'])) {
             $where['phone_password'] = $this->_post('phone_password', 'trim');
         }
         if ($db->save($where)) {
             $this->success('更新成功', U('Call/index'));
         } else {
             $this->error('更新失敗', U('Call/index'));
         }
     }
 }
開發者ID:dalinhuang,項目名稱:wxMall,代碼行數:34,代碼來源:CallAction.class.php


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