当前位置: 首页>>代码示例>>PHP>>正文


PHP print_R函数代码示例

本文整理汇总了PHP中print_R函数的典型用法代码示例。如果您正苦于以下问题:PHP print_R函数的具体用法?PHP print_R怎么用?PHP print_R使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_R函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare

 /**
  * 初始化数据库配置
  * @param string $table
  * @param boolean $isMaster
  * @param boolean $isPersistent
  * @return Base_Db
  */
 public function prepare($table, $isMaster = false, $isPersistent = false)
 {
     $t = explode(".", $table);
     $table = $t[count($t) - 1];
     if (!isset($this->tableConf[$table])) {
         echo $table . "<br>";
         print_R($this->tableConf);
         die($table . ' to database config error');
     }
     $dbKey = $this->tableConf[$table]['db'];
     $db_count = count($this->dbConf[$dbKey]);
     $writeConf = array('host' => $this->dbConf[$dbKey][0]['host'], 'user' => $this->dbConf[$dbKey][0]['user'], 'password' => $this->dbConf[$dbKey][0]['password'], 'port' => empty($this->dbConf[$dbKey][0]['port']) ? 3306 : $this->dbConf[$dbKey][0]['port'], 'database' => $this->dbConf[$dbKey][0]['database']);
     //if (isset($this->dbConf[$dbKey][1]))
     if ($db_count >= 2) {
         $rand = rand(1, $db_count - 1);
         $readConf = array('host' => $this->dbConf[$dbKey][$rand]['host'], 'user' => $this->dbConf[$dbKey][$rand]['user'], 'password' => $this->dbConf[$dbKey][$rand]['password'], 'port' => empty($this->dbConf[$dbKey][$rand]['port']) ? 3306 : $this->dbConf[$dbKey][$rand]['port'], 'database' => $this->dbConf[$dbKey][$rand]['database']);
     } else {
         $readConf = $writeConf;
     }
     $key = md5($writeConf['host'] . ':' . $writeConf['port'] . ';' . $writeConf['user'] . ':' . $writeConf['password']);
     if (isset($this->oDbArr[$key]) && is_object($this->oDbArr[$key])) {
         if ($isMaster) {
             $this->oDbArr[$key]->setIsMaster($isMaster);
         }
     } else {
         $oDb = new Base_Db();
         $oDb->setReadConf($readConf);
         $oDb->setWriteConf($writeConf);
         $oDb->setIsMaster($isMaster);
         $isPersistent = $isPersistent || $this->dbConf['isPersistent'];
         $oDb->setIsPersistent($isPersistent);
         $this->oDbArr[$key] = $oDb;
     }
     return $this->oDbArr[$key];
 }
开发者ID:eappl,项目名称:prototype,代码行数:42,代码来源:Hash.php

示例2: execute

 /**
  * method to execute the query
  * it's called automatically by the api main controller
  */
 public function execute()
 {
     Billrun_Factory::log()->log("Execute api query billrun", Zend_Log::INFO);
     $request = $this->getRequest()->getRequest();
     // supports GET / POST requests
     Billrun_Factory::log()->log("Input: " . print_R($request, 1), Zend_Log::INFO);
     if (!isset($request['aid'])) {
         $this->setError('Require to supply aid or sid', $request);
         return true;
     }
     $find = array();
     $max_list = 1000;
     if (isset($request['aid'])) {
         $aids = Billrun_Util::verify_array($request['aid'], 'int');
         if (count($aids) > $max_list) {
             $this->setError('Maximum of aid is ' . $max_list, $request);
             return true;
         }
         $find['aid'] = array('$in' => $aids);
     }
     if (isset($request['billrun'])) {
         $find['billrun_key'] = $this->getBillrunQuery($request['billrun']);
     }
     $options = array('sort' => array('aid', 'billrun_key'));
     $cacheParams = array('fetchParams' => array('options' => $options, 'find' => $find));
     $this->setCacheLifeTime(604800);
     // 1 week
     $results = $this->cache($cacheParams);
     Billrun_Factory::log()->log("query success", Zend_Log::INFO);
     $ret = array(array('status' => 1, 'desc' => 'success', 'input' => $request, 'details' => $results));
     $this->getController()->setOutput($ret);
 }
开发者ID:ngchie,项目名称:system,代码行数:36,代码来源:Billrun.php

示例3: Create

 public function Create($team, $user)
 {
     $locationFormat = $this->Parent->RootDomain . "{apiKey}/v{apiVersion}/team/" . $team['teamShortName'];
     $url = $this->BuildUrl($locationFormat);
     $payload = json_encode($team);
     $fh = fopen('php://temp', 'r+');
     fwrite($fh, $payload);
     rewind($fh);
     $this->curlWrapper->resetAll();
     $this->curlWrapper->setDefaults();
     if ($this->Parent->Debug) {
         $this->curlWrapper->addOption(CURLOPT_VERBOSE, 1);
     }
     $this->curlWrapper->addOption(CURLOPT_USERPWD, $this->Parent->Username . ":" . $this->Parent->Password);
     $this->curlWrapper->addOption(CURLOPT_PUT, true);
     $this->curlWrapper->addOption(CURLOPT_INFILE, $fh);
     $this->curlWrapper->addOption(CURLOPT_INFILESIZE, strlen($payload));
     $this->curlWrapper->addHeader(array('Accept' => 'application/json', 'Content-type' => 'application/json', 'Authorize' => 'Basic ' . $user, 'Authorization' => 'Basic ' . $user));
     $json = $this->curlWrapper->put($url);
     $cntent = print_R($this->curlWrapper, true);
     if ($this->curlWrapper->getTransferInfo('http_code') == 200) {
         //updated
         return true;
     } elseif ($this->curlWrapper->getTransferInfo('http_code') == 201) {
         //created
         return true;
     } else {
         return false;
         //$this->curlWrapper->getTransferInfo();
     }
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:31,代码来源:TeamApi.php

示例4: test

 public function test()
 {
     $aModel = TuiyoLoader::model("applications", true);
     $aUser = TuiyoAPI::get("user", null);
     $aDocument = TuiyoAPI::get("document", null);
     $aParams = $aModel->getSingleUserPlugin($aUser->id, "twitter");
     if (!is_object($aParams)) {
         $aDocument->enqueMessage(_("Cannot Load the service for this user"), "error");
         return false;
     }
     echo $aParams->get("oauth_verifier");
     /* Build TwitterOAuth object with client credentials. */
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
     $view =& $this->getView("twitter", "html");
     /* Get temporary credentials. */
     $access_token = $connection->getAccessToken($aParams->get('oauth_verifier', false));
     /* Create a TwitterOauth object with consumer/user tokens. */
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
     /* If method is set change API call made. Test is called by default. */
     $content = $connection->get('account/verify_credentials');
     //print_R($content);
     $user = $connection->get('account/verify_credentials');
     $userPublicFeeds = $connection->get('statuses/public_timeline');
     print_R($userPublicFeeds);
 }
开发者ID:night-coder,项目名称:ignite,代码行数:25,代码来源:controller.php

示例5: applyFilters

 function applyFilters($q, $au)
 {
     if (!empty($q['query']['_sync'])) {
         // use the basic builder modules for this project based on configurion.
         // what do we have..
         //DB_DataObject::DebugLevel(1);
         $x = DB_DataObject::factory('builder_modules');
         $modpaths = $x->fetchAll('name', 'path');
         $ff = HTML_FlexyFramework::get();
         foreach ($ff->enableArray as $m) {
             if (isset($modpaths[$m])) {
                 continue;
             }
             if (file_exists($ff->baseDir . '/' . $m)) {
                 $x = DB_DataObject::factory('builder_modules');
                 $x->setFrom(array('name' => $m, 'path' => $ff->baseDir . '/' . $m, 'public' => 0));
                 $x->insert();
             }
         }
         $ff->page->jok("Synced");
         //$mods = $ff->enableArray;
         echo '<PRE>';
         print_R($ff);
         exit;
     }
 }
开发者ID:roojs,项目名称:Pman.Builder,代码行数:26,代码来源:Builder_modules.php

示例6: show

 public function show()
 {
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'user_queue ';
     $orderby = ' ORDER BY update_time ASC';
     $limit = ' limit 0,' . CHARGE_LIMIT;
     $query = $this->db->query($sql . $orderby . $limit);
     $queue = array();
     while ($row = $this->db->fetch_array($query)) {
         $queue[] = $row;
     }
     if ($queue) {
         foreach ($queue as $v) {
             if (!$v['bucket_name'] || !$v['domain']) {
                 continue;
             }
             $param = array('bucket_name' => $v['bucket_name'], 'domain' => $v['domain'], 'start_day' => '', 'period' => 1);
             //查询流量
             $status = $this->upyun->BucketStatus($param);
             print_R($status);
             exit;
             if ($status['discharge']) {
                 $total = 0;
                 foreach ($status['discharge'] as $val) {
                     $total = $total + $val;
                 }
                 $charge = $total / 1024 / 1024 / 1024 * DISCHARGE;
             }
             $sql = 'REPLACE INTO ' . DB_PREFIX . 'realtime_charge VALUE(' . $v['user_id'] . ',' . $charge . ',' . TIMENOW . ')';
             $this->db->query($sql);
             $sql = 'UPDATE ' . DB_PREFIX . 'user_queue SET update_time=' . TIMENOW . ' WHERE user_id=' . $v['user_id'];
             $this->db->query($sql);
         }
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:34,代码来源:realpay.php

示例7: actionAccessToken

 public static function actionAccessToken($get = false)
 {
     $ret = Wxaccesstoken::model()->findByAttributes(array('appid' => APP_ID));
     if (!$ret) {
         $ret = new Wxaccesstoken();
         $ret->appid = APP_ID;
         $ret->appsecret = APP_SECRET;
         $ret->create_at = date("Y-m-d H:i:s", time());
         $ret->save();
     }
     if (empty($ret->accesstoken) || $ret->expire_at < time() || $get) {
         $app_id = APP_ID;
         $app_sec = APP_SECRET;
         $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$app_id}&secret={$app_sec}";
         $response = Yii::app()->curl->get($url);
         $response = json_decode($response, true);
         if (isset($response['errcode'])) {
             Yii::trace(CVarDumper::dumpAsString($response), 'get accesstoken ERROR');
         } else {
             $ret->accesstoken = $response['access_token'];
             $ret->expire_at = time() + $response['expires_in'] - 300;
             if (!$ret->save()) {
                 print_R($ret->errors);
             }
         }
     }
     return $ret->accesstoken;
 }
开发者ID:CenturyWarDesign,项目名称:umbrella,代码行数:28,代码来源:WX.php

示例8: indexAction

 public function indexAction()
 {
     $Base = \AliOSS\Base::Instance();
     $Base->getALIOSSSDK()->setEnableDomainStyle(true);
     $data['list'] = $Base->getALIOSSSDK()->listBucket();
     print_R($data);
     /**
      *列出Bucket内所有文件
      *递归列出目录下所有文件
      */
     $prefix = '';
     $marker = '';
     $delimiter = '';
     $next_marker = '';
     $maxkeys = 1000;
     $index = 1;
     while (true) {
         $options = array('delimiter' => $delimiter, 'prefix' => $prefix, 'max-keys' => $maxkeys, 'marker' => $next_marker);
         $res = $Base->getALIOSSSDK()->listObject($Base->getBucketName(), $options);
         $msg = "列出Bucket内所有文件" . $Base->getBucketName();
         if ($res->isOk()) {
             $body = $res->body;
             $tmp_object_list = OSSUtil::get_object_list_marker_from_xml($body, $next_marker);
             //打印出所有的object名称
             foreach ($tmp_object_list as $key) {
                 $data['file'][$index] = $key;
                 $index++;
             }
         }
     }
     print_R($data);
 }
开发者ID:tkaven,项目名称:biyeyuan,代码行数:32,代码来源:Test.php

示例9: execute

 /**
  * method to execute remove of billing lines (only credit and active)
  * it's called automatically by the api main controller
  */
 public function execute()
 {
     Billrun_Factory::log()->log("Execute api remove", Zend_Log::INFO);
     $request = $this->getRequest()->getRequest();
     // supports GET / POST requests
     Billrun_Factory::log()->log("Input: " . print_R($request, 1), Zend_Log::INFO);
     $stamps = array();
     foreach ($request['stamps'] as $line_stamp) {
         $clear_stamp = Billrun_Util::filter_var($line_stamp, FILTER_SANITIZE_STRING, FILTER_FLAG_ALLOW_HEX);
         if (!empty($clear_stamp)) {
             $stamps[] = $clear_stamp;
         }
     }
     if (empty($stamps)) {
         Billrun_Factory::log()->log("remove action failed; no correct stamps", Zend_Log::INFO);
         $this->getController()->setOutput(array(array('status' => false, 'desc' => 'failed - invalid stamps input', 'input' => $request)));
         return true;
     }
     $model = new LinesModel();
     $query = array('source' => 'api', 'stamp' => array('$in' => $stamps), '$or' => array(array('billrun' => array('$gte' => Billrun_Billrun::getActiveBillrun())), array('billrun' => array('$exists' => false))));
     $ret = $model->remove($query);
     if (!isset($ret['ok']) || !$ret['ok'] || !isset($ret['n'])) {
         Billrun_Factory::log()->log("remove action failed pr miscomplete", Zend_Log::INFO);
         $this->getController()->setOutput(array(array('status' => false, 'desc' => 'remove failed', 'input' => $request)));
         return true;
     }
     Billrun_Factory::log()->log("remove success", Zend_Log::INFO);
     $this->getController()->setOutput(array(array('status' => $ret['n'], 'desc' => 'success', 'input' => $request)));
 }
开发者ID:ngchie,项目名称:system,代码行数:33,代码来源:Remove.php

示例10: send

 /**
  * method to send
  * 
  * @param type $message
  * @param type $recipients
  * @return \Billrun_Sms|boolean
  */
 public function send($message, $recipients)
 {
     if (empty($message) || empty($recipients)) {
         Billrun_Factory::log()->log("can not send the sms, there are missing params - txt: " . $this->data['message'] . " recipients: " . print_r($this->data['recipients'], TRUE) . " from: " . $this->data['from'], Zend_Log::WARN);
         return false;
     }
     $unicode_text = $this->sms_unicode($message);
     if (!empty($message) && empty($unicode_text)) {
         $language = '1';
     } else {
         $language = '2';
     }
     // Temporary - make sure is not 23 chars long
     $text = str_pad($message, 24, '+');
     $period = 120;
     foreach ($recipients as $recipient) {
         $send_params = array('message' => $text, 'to' => $recipient, 'from' => $this->data['from'], 'language' => $language, 'username' => $this->data['user'], 'password' => $this->data['pwd'], 'acknowledge' => "false", 'period' => $period, 'channel' => "SRV");
         $url = $this->data['provisioning'] . "?" . http_build_query($send_params);
         $sms_result = Billrun_Util::sendRequest($url);
         $exploded = explode(',', $sms_result);
         $response = array('error-code' => empty($exploded[0]) ? 'error' : 'success', 'cause-code' => $exploded[1], 'error-description' => $exploded[2], 'tid' => $exploded[3]);
         Billrun_Factory::log()->log("phone: " . $recipient . " encoded_text: " . $message . " url: " . $url . " result" . print_R($response, 1), Zend_Log::INFO);
     }
     return $response['error-code'] == 'success' ? true : false;
 }
开发者ID:ngchie,项目名称:system,代码行数:32,代码来源:Sms.php

示例11: _sendEmay

 /**
  * 亿美短信发送接口
  * @param unknown $mobile 手机号
  * @param unknown $content 短信内容
  */
 private function _sendEmay($mobile, $content)
 {
     set_time_limit(0);
     define('SCRIPT_ROOT', BASE_DATA_PATH . '/api/emay/');
     require_once SCRIPT_ROOT . 'include/Client.php';
     /**
      * 网关地址
      */
     $gwUrl = C('sms.gwUrl');
     /**
      * 序列号,请通过亿美销售人员获取
      */
     $serialNumber = C('sms.serialNumber');
     /**
      * 密码,请通过亿美销售人员获取
      */
     $password = C('sms.password');
     /**
      * 登录后所持有的SESSION KEY,即可通过login方法时创建
      */
     $sessionKey = C('sms.sessionKey');
     /**
      * 连接超时时间,单位为秒
      */
     $connectTimeOut = 2;
     /**
      * 远程信息读取超时时间,单位为秒
      */
     $readTimeOut = 10;
     /**
     $proxyhost		可选,代理服务器地址,默认为 false ,则不使用代理服务器
     $proxyport		可选,代理服务器端口,默认为 false
     $proxyusername	可选,代理服务器用户名,默认为 false
     $proxypassword	可选,代理服务器密码,默认为 false
     */
     $proxyhost = false;
     $proxyport = false;
     $proxyusername = false;
     $proxypassword = false;
     $client = new Client($gwUrl, $serialNumber, $password, $sessionKey, $proxyhost, $proxyport, $proxyusername, $proxypassword, $connectTimeOut, $readTimeOut);
     /**
      * 发送向服务端的编码,如果本页面的编码为GBK,请使用GBK
      */
     $client->setOutgoingEncoding("UTF-8");
     $statusCode = $client->login();
     if ($statusCode != null && $statusCode == "0") {
     } else {
         //登录失败处理
         //    echo "登录失败,返回:".$statusCode;exit;
     }
     $statusCode = $client->sendSMS(array($mobile), $content);
     if ($statusCode != null && $statusCode == "0") {
         return true;
     } else {
         return false;
         print_R($statusCode);
         echo "处理状态码:" . $statusCode;
     }
 }
开发者ID:xuxuecheng,项目名称:shopnc,代码行数:64,代码来源:sms.php

示例12: AjaxDataRoam

 public function AjaxDataRoam()
 {
     print_R($_REQUEST);
     $soucemodel = $_REQUEST['val'][0]['sourcemodel'];
     $sourceid = $_REQUEST['val'][0]['sourceid'];
     $targetmodel = $_REQUEST['val'][0]['targetmodel'];
     $this->lookupDataRoamPull($soucemodel, $sourceid, $targetmodel);
 }
开发者ID:tmlsoft,项目名称:main,代码行数:8,代码来源:MisSystemDataRoamingAction.class.php

示例13: prr

 public function prr($arr, $exit = null)
 {
     echo '<pre>';
     print_R($arr);
     echo '</pre>';
     if (!is_null($exit)) {
         exit;
     }
 }
开发者ID:nitin-prodigi,项目名称:mesa,代码行数:9,代码来源:Mesa.php

示例14: debug

 static function debug($s, $e = 0)
 {
     if (!$GLOBALS['_XML_SVGTOPDF']['options']['debug']) {
         return;
     }
     echo "<PRE>" . print_R($s, true) . "</PRE>";
     if ($e) {
         exit;
     }
 }
开发者ID:roojs,项目名称:pear,代码行数:10,代码来源:SvgToPdf.php

示例15: execute

 /**
  * method to execute the query
  * it's called automatically by the api main controller
  */
 public function execute()
 {
     Billrun_Factory::log()->log("Execute api query aggregate", Zend_Log::INFO);
     $request = $this->getRequest()->getRequest();
     // supports GET / POST requests
     Billrun_Factory::log()->log("Input: " . print_R($request, 1), Zend_Log::DEBUG);
     if (!isset($request['aid']) && !isset($request['sid'])) {
         $this->setError('Require to supply aid or sid', $request);
         return true;
     }
     $find = array();
     $max_list = 1000;
     if (isset($request['aid'])) {
         $aids = Billrun_Util::verify_array($request['aid'], 'int');
         if (count($aids) > $max_list) {
             $this->setError('Maximum of aid is ' . $max_list, $request);
             return true;
         }
         $find['aid'] = array('$in' => $aids);
     }
     if (isset($request['sid'])) {
         $sids = Billrun_Util::verify_array($request['sid'], 'int');
         if (count($sids) > $max_list) {
             $this->setError('Maximum of sid is ' . $max_list, $request);
             return true;
         }
         $find['sid'] = array('$in' => $sids);
     }
     if (isset($request['billrun'])) {
         $find['billrun'] = $this->getBillrunQuery($request['billrun']);
     }
     if (isset($request['query'])) {
         $query = $this->getArrayParam($request['query']);
         $find = array_merge($find, (array) $query);
     }
     if (isset($request['groupby'])) {
         $groupby = array('_id' => $this->getArrayParam($request['groupby']));
     } else {
         $groupby = array('_id' => null);
     }
     if (isset($request['aggregate'])) {
         $aggregate = $this->getArrayParam($request['aggregate']);
     } else {
         $aggregate = array('count' => array('$sum' => 1));
     }
     $group = array_merge($groupby, $aggregate);
     $options = array('sort' => array('urt'), 'page' => isset($request['page']) && $request['page'] > 0 ? (int) $request['page'] : 0, 'size' => isset($request['size']) && $request['size'] > 0 ? (int) $request['size'] : 1000);
     $cacheParams = array('fetchParams' => array('options' => $options, 'find' => $find, 'group' => $group, 'groupby' => $groupby));
     $this->setCacheLifeTime(604800);
     // 1 week
     $results = $this->cache($cacheParams);
     Billrun_Factory::log()->log("Aggregate query success", Zend_Log::INFO);
     $ret = array(array('status' => 1, 'desc' => 'success', 'input' => $request, 'details' => $results));
     $this->getController()->setOutput($ret);
 }
开发者ID:ngchie,项目名称:system,代码行数:59,代码来源:Aggregate.php


注:本文中的print_R函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。