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


PHP vendor函數代碼示例

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


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

示例1: exportExcel

 function exportExcel($expTitle, $expCellName, $expTableData)
 {
     $xlsTitle = iconv('utf-8', 'gb2312', $expTitle);
     //文件名稱
     $fileName = $_SESSION['account'] . date('_YmdHis');
     //or $xlsTitle 文件名稱可根據自己情況設定
     $cellNum = count($expCellName);
     $dataNum = count($expTableData);
     vendor("PHPExcel.PHPExcel");
     $objPHPExcel = new \PHPExcel();
     $cellName = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ');
     $objPHPExcel->getActiveSheet(0)->mergeCells('A1:' . $cellName[$cellNum - 1] . '1');
     //合並單元格
     for ($i = 0; $i < $cellNum; $i++) {
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue($cellName[$i] . '2', $expCellName[$i][1]);
     }
     for ($i = 0; $i < $dataNum; $i++) {
         for ($j = 0; $j < $cellNum; $j++) {
             $objPHPExcel->getActiveSheet(0)->setCellValue($cellName[$j] . ($i + 3), $expTableData[$i][$expCellName[$j][0]]);
         }
     }
     header('pragma:public');
     header('Content-type:application/vnd.ms-excel;charset=utf-8;name="' . $xlsTitle . '.xls"');
     header("Content-Disposition:attachment;filename={$fileName}.xls");
     //attachment新窗口打印inline本窗口打印
     $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     //$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     exit;
 }
開發者ID:Hitwjm,項目名稱:dxms,代碼行數:30,代碼來源:GradeController.class.php

示例2: _initialize

 function _initialize()
 {
     $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     if ($_GET != null) {
         $info["openid"] = $_GET["openid"];
         cookie('USER_INFO', $info, 3600 * 24 * 365);
     }
     $time = date("Y-m-d");
     if (D("time")->where(array("time" => $time))->find() != null) {
         D("time")->where(array("time" => $time))->setInc("no");
     } else {
         D("time")->add(array("time" => $time, "no" => 1));
     }
     $temp = get_config();
     $this->assign("con", $temp);
     // cookie('USER_INFO', array('openid' => 'ooJsMuBae9b3XHJVptSqp1Jr9Tw4'), 3600 * 521);
     $user = cookie('USER_INFO');
     $openid = $user['openid'];
     vendor('Wx.Jssdk');
     $jssdk = new JSSDK($temp["AppId"], $temp["AppSecret"]);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign("signPackage", $signPackage);
     $one = D("Account")->where(array("openid" => $openid))->find();
     if ($one["nickname"] == "" || $one["nickname"] != null) {
         D("Account")->where(array("openid" => $openid))->save(array("nickname" => $user["nickname"]));
     }
     if (empty($openid)) {
         //$this->redirect("Auth/oauth");
         header("Location:" . 'http://mt.magicgell.com/user/openid?redirect=' . $url);
     } else {
     }
 }
開發者ID:xibaachao,項目名稱:1bz,代碼行數:32,代碼來源:BaseAction.class.php

示例3: keyword

 /**
  * [keyword 獲取關鍵詞]
  * @param  [type] $text   [文本]
  * @param  string $filter [過濾條件]
  * @return [type]         [description]
  */
 public function keyword($text, $filter = '')
 {
     $filter = $this->makeFilter($filter);
     vendor('pscws4.class#pscws4');
     $pscws = new PSCWS4();
     $pscws->set_charset('utf-8');
     $pscws->send_text($text);
     $some = $pscws->get_tops(10, $filter);
     $_result = $this->makeAttr($some);
     $filter_reg = explode(',', str_replace('~', '', $filter));
     if (!empty($filter)) {
         if ($filter != "~") {
             foreach ($_result as $k => $v) {
                 if (in_array($v['attr'], $filter_reg)) {
                     $_res[] = $v;
                 }
             }
         } else {
             $_res = $_result;
         }
     } else {
         $_res = $_result;
     }
     return $_res;
 }
開發者ID:js-wei,項目名稱:Wechat,代碼行數:31,代碼來源:Fenci.class.php

示例4: get_user_openid

 public function get_user_openid($code)
 {
     //url:https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
     $url = 'https://api.weixin.qq.com/sns/oauth2/access_token';
     vendor('Weixinpay.WxPayJsApiPay');
     $appid = \WxPayConfig::APPID;
     $crypt = \WxPayConfig::APPSECRET;
     $param = array('appid' => $appid, 'secret' => $crypt, 'code' => $code, 'grant_type' => 'authorization_code');
     $result = get($url, $param);
     $result = json_decode($result);
     //處理object
     $result = object_array($result);
     //獲取長久一點的access_token
     //url:https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN
     $result = get("https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=" . $appid . "&grant_type=refresh_token&refresh_token=" . $result['refresh_token'] . "");
     $result = json_decode($result);
     //處理object
     $result = object_array($result);
     //如果返回錯誤信息
     if (!empty($result['errcode'])) {
         $this->error('網站錯誤,請聯係管理員' . $result['errcode'] . '');
     } else {
         return $result;
     }
 }
開發者ID:Jitlee,項目名稱:CKY,代碼行數:25,代碼來源:KanjiaAction.class.php

示例5: __construct

 public function __construct()
 {
     vendor("wechat");
     $wechat = new wechat();
     $wechat->valid();
     $wechat->createMenu();
 }
開發者ID:jecky2013,項目名稱:diancanba,代碼行數:7,代碼來源:WechatAction.class.php

示例6: 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

示例7: index

 public function index()
 {
     //TODO: 生成二維碼
     vendor("Org.PhpQrcode.QrcodeHelper");
     $qrcode = new QrcodeHelper();
     dump($qrcode);
 }
開發者ID:netsnail,項目名稱:201507guoshu,代碼行數:7,代碼來源:QrcodeController.class.php

示例8: __construct

 /**
  * 架構函數
  */
 public function __construct()
 {
     //控製器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //導入類庫
     vendor('Hprose.Hprose', COMMON_PATH . 'Vendor/');
     //實例化HproseHttpServer
     $server = new \HproseHttpServer();
     if (empty($this->allowMethodList)) {
         $methods = get_class_methods($this);
         $methods = array_diff($methods, array('__construct', '__call', '_initialize'));
     } else {
         $methods = $this->allowMethodList;
     }
     $server->addMethods($methods, $this);
     if (APP_DEBUG || $this->debug) {
         $server->setDebugEnabled(TRUE);
     }
     //Hprose設置
     $server->setCrossDomainEnabled($this->crossDomain);
     $server->setP3PEnabled($this->P3P);
     $server->setGetEnabled($this->get);
     //啟動server
     $server->start();
 }
開發者ID:925800521,項目名稱:itskycms,代碼行數:30,代碼來源:HproseController.class.php

示例9: SendMail

function SendMail($address, $message)
{
    vendor('PHPMailer.class#phpmailer');
    $mail = new PHPMailer();
    // 設置PHPMailer使用SMTP服務器發送Email
    $mail->IsSMTP();
    // 設置郵件的字符編碼,若不指定,則為'UTF-8'
    $mail->IsHTML(true);
    //支持html格式內容
    $mail->CharSet = 'UTF-8';
    // 添加收件人地址,可以多次使用來添加多個收件人
    $mail->AddAddress($address);
    // 設置郵件正文
    $mail->Body = $message;
    // 設置郵件頭的From字段。
    $mail->From = C('MAIL_ADDRESS');
    // 設置發件人名
    $mail->FromName = C('MAIL_FORMNAME');
    // 設置郵件標題
    $mail->Subject = C('MAIL_TITLE');
    // 設置SMTP服務器。
    $mail->Host = C('MAIL_SMTP');
    // 設置為"需要驗證" ThinkPHP 的C方法讀取配置文件
    $mail->SMTPAuth = true;
    // 設置用戶名和密碼。
    $mail->Username = C('MAIL_LOGINNAME');
    $mail->Password = C('MAIL_PASSWORD');
    // 發送郵件。
    return $mail->Send();
}
開發者ID:yunyouming,項目名稱:bebtc.com,代碼行數:30,代碼來源:function.php

示例10: init

 /**
  * Initializes the pager. Must be called before using the component.
  *
  * Takes user configuration and creates pager object ($this->Pager)
  *
  * @access public
  * @param array $config Configuration options for Pager::factory() method
  * @see http://pear.php.net/manual/en/package.html.pager.factory.php
  * @return void
  */
 function init($config)
 {
     // Get the correct URL, even with admin routes
     $here = array();
     if (defined('CAKE_ADMIN') && !empty($this->Controller->params[CAKE_ADMIN])) {
         $here[0] = $this->Controller->params[CAKE_ADMIN];
         $here[2] = substr($this->Controller->params['action'], strlen($this->Controller->params[CAKE_ADMIN]) + 1);
     } else {
         $here[2] = $this->Controller->params['action'];
     }
     $here[1] = Inflector::underscore($this->Controller->params['controller']);
     ksort($here);
     $url = implode('/', $here);
     // Set up the default configuration vars
     $this->params = array('mode' => 'Sliding', 'perPage' => 10, 'delta' => 5, 'totalItems' => '', 'httpMethod' => 'GET', 'currentPage' => 1, 'linkClass' => 'pager', 'altFirst' => 'First page', 'altPrev ' => 'Previous page', 'altNext' => 'Next page', 'altLast' => 'Last page', 'separator' => '', 'spacesBeforeSeparator' => 1, 'spacesAfterSeparator' => 1, 'useSessions' => false, 'firstPagePre' => '', 'firstPagePost' => '', 'firstPageText' => '<img src="' . $this->Controller->base . '/img/first.gif" alt="">', 'lastPagePre' => '', 'lastPagePost' => '', 'lastPageText' => '<img src="' . $this->Controller->base . '/img/last.gif" alt="">', 'prevImg' => '<img src="' . $this->Controller->base . '/img/prev.gif" alt="">', 'nextImg' => '<img src="' . $this->Controller->base . '/img/next.gif" alt="">', 'altPage' => 'Page', 'clearIfVoid' => true, 'append' => false, 'path' => '', 'fileName' => $this->Controller->base . DS . $url . DS . '%d', 'urlVar' => '');
     vendor('Pear/Pager/Pager');
     // Merge with user config
     $this->params = array_merge($this->params, $config);
     // sanitize requested page number
     if (!in_array($this->params['currentPage'], range(1, ceil($this->params['totalItems'] / $this->params['perPage'])))) {
         $this->params['currentPage'] = 1;
     }
     $this->Pager =& Pager::factory($this->params);
     // Set the template vars
     $this->Controller->set('pageLinks', $this->Pager->getLinks());
     $this->Controller->set('currentPage', $this->params['currentPage']);
     $this->Controller->set('isFirstPage', $this->Pager->isFirstPage());
     $this->Controller->set('isLastPage', $this->Pager->isLastPage());
 }
開發者ID:uwitec,項目名稱:eduoa,代碼行數:39,代碼來源:pager.php

示例11: doUpload

 /**
  * @param   class   doUpload    文件上傳封裝類
  * @const   ACCESS  SECRET      七牛雲的秘鑰
  * @param   array   $file       前台name的上傳文件名
  * @return  string  $key        文件路徑
  * @author   GIO    645074190@qq.com
  */
 public function doUpload($file = array())
 {
     vendor('php-sdk-master.autoload');
     $auth = new Auth(self::ACCESS, self::SECRET);
     //實例化一個Auth類
     $bucket = 'xmmusic';
     //要上傳的空間名
     $token = $auth->uploadToken($bucket);
     //生成上傳的Token
     $filePath = $file['tmp_name'];
     //上傳的本地文件路徑
     $str = $file['name'];
     $pathInfo = pathinfo($str);
     $suffix = $pathInfo['dirname'] . $pathInfo['extension'];
     //生成上傳文件的後綴名
     if (empty($suffix)) {
         $this->error('請上傳掃描文件', 'index');
     } else {
         $key = date('Ymd', time()) . mt_rand(1000, 9000) . $suffix;
         /*上傳到七牛雲後保存的隨機文件名*/
         $uploadMgr = new UploadManager();
         /*初始化 UploadManager 對象並進行文件的上傳*/
         list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath);
         return $key;
     }
 }
開發者ID:feng8605765,項目名稱:xmmusic,代碼行數:33,代碼來源:CompanyController.class.php

示例12: read

 function read()
 {
     vendor('Excel' . DS . 'reader');
     $this->SER = new Spreadsheet_Excel_Reader();
     $this->SER->setOutputEncoding = $this->setOutputEncoding;
     $this->SER->read($this->file);
 }
開發者ID:venka10,項目名稱:RUS,代碼行數:7,代碼來源:excel.php

示例13: init

 public function init($type)
 {
     ini_set('display_errors', 1);
     error_reporting(E_ALL);
     vendor("OAuth2.Autoloader");
     $loader = new Autoloader();
     $loader::register();
     //數據庫存儲
     $storage = $this->getMysqlStorage();
     // Pass a storage object or array of storage objects to the OAuth2 server class
     if ($type == self::IMPLICIT) {
         $server = new Server($storage, array('allow_implicit' => true));
     } else {
         $server = new Server($storage, array('allow_implicit' => false));
     }
     if ($type == self::CLIENT_CREDENTIALS) {
         // 客戶端授權類型
         $server->addGrantType(new ClientCredentials($storage, array('allow_credentials_in_request_body => true')));
     } elseif ($type == self::AUTHORIZATION_CODE) {
         // 增加授權碼模式授權類型
         $server->addGrantType(new AuthorizationCode($storage));
     } elseif ($type == self::PASSWORD) {
         // 增加password模式授權類型
         $server->addGrantType(new UserCredentials($storage));
     } else {
         // 增加password模式授權類型
         $server->addGrantType(new UserCredentials($storage));
         // 增加授權碼模式授權類型
         $server->addGrantType(new AuthorizationCode($storage));
         // 客戶端授權類型
         $server->addGrantType(new ClientCredentials($storage));
     }
     return $server;
 }
開發者ID:h136799711,項目名稱:201507banma,代碼行數:34,代碼來源:OAuth2Service.class.php

示例14: push

/**
 * Push
 *
 * @param string $message
 *            Message content
 * @param int $receiver_type
 *            Receiver type(1:IMEI(Must special appKeys first),2:tag,3:alias,4:broadcast
 * @param string $receiver_value
 *            Relative with Reciever type
 * @param int $is_system
 *            (1:yes,0:no)
 * @param int|null $goods_id
 *            Goods id
 * @return boolean
 */
function push($message, $receiver_type = 4, $receiver_value = '', $is_system = 1, $goods_id = null)
{
    vendor('jpush.JPushClient');
    $jPush_config = C('JPush');
    $url = 'http://api.jpush.cn:8800/v2/push';
    $param = '';
    $param .= '&sendno=1';
    $param .= '&app_key=' . $jPush_config['app_key'];
    $param .= '&receiver_type=' . $receiver_type;
    $param .= '&receiver_value=' . $receiver_value;
    $masterSecret = $jPush_config['master_secret'];
    $verification_code = md5(1 . $receiver_type . $receiver_value . $masterSecret);
    $param .= '&verification_code=' . $verification_code;
    $param .= '&msg_type=1';
    $message = json_encode(array('n_content' => $message, 'n_extras' => array('ios' => array('content-available' => 1), 'is_system' => $is_system, 'goods_id' => $goods_id)));
    $param .= '&msg_content=' . $message;
    $param .= '&platform=' . $jPush_config['platform'];
    if (empty($url) || empty($param)) {
        return false;
    }
    $postUrl = $url;
    $curlPost = $param;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $postUrl);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
    $data = json_decode(curl_exec($ch));
    curl_close($ch);
    return $data->errcode ? false : true;
}
開發者ID:leamiko,項目名稱:project_2,代碼行數:47,代碼來源:common.php

示例15: sendMail

/**
 * 郵件發送函數
 */
function sendMail($to, $subject, $content)
{
    vendor('PHPMailer.PHPMailerAutoload');
    $mail = new PHPMailer();
    // 裝配郵件服務器
    if (C('MAIL_SMTP')) {
        $mail->IsSMTP();
    }
    $mail->Host = C('MAIL_HOST');
    $mail->SMTPAuth = C('MAIL_SMTPAUTH');
    $mail->Username = C('MAIL_USERNAME');
    $mail->Password = C('MAIL_PASSWORD');
    $mail->SMTPSecure = C('MAIL_SECURE');
    $mail->CharSet = C('MAIL_CHARSET');
    // 裝配郵件頭信息
    $mail->From = C('MAIL_USERNAME');
    $mail->AddAddress($to);
    $mail->FromName = '憨豆兒笑園';
    $mail->IsHTML(C('MAIL_ISHTML'));
    // 裝配郵件正文信息
    $mail->Subject = $subject;
    $mail->Body = $content;
    // 發送郵件
    if (!$mail->Send()) {
        return false;
    } else {
        return true;
    }
}
開發者ID:huzhengchuan,項目名稱:pay,代碼行數:32,代碼來源:function.php


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