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


PHP var_dump函数代码示例

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


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

示例1: dump

function dump($var, $echo = true, $label = null, $strict = true)
{
    $label = $label === null ? '' : rtrim($label) . ' ';
    if (!$strict) {
        if (ini_get('html_errors')) {
            $output = print_r($var, true);
            $output = "<pre>" . $label . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        } else {
            $output = $label . " : " . print_r($var, true);
        }
    } else {
        ob_start();
        var_dump($var);
        $output = ob_get_clean();
        if (!extension_loaded('xdebug')) {
            $output = preg_replace("/\\]\\=\\>\n(\\s+)/m", "] => ", $output);
            $output = '<pre>' . $label . htmlspecialchars($output, ENT_QUOTES, "GB2312") . '</pre>';
        }
    }
    if ($echo) {
        echo $output;
        return null;
    } else {
        return $output;
    }
}
开发者ID:winiceo,项目名称:job,代码行数:26,代码来源:lib.php

示例2: _testXPath

 function _testXPath($xpath_expression)
 {
     if (!class_exists('DOMDocument') || !class_exists('DOMXPath')) {
         if (function_exists('domxml_open_mem')) {
             $dom = domxml_open_mem($this->_response);
             if (!$dom) {
                 $this->fail('Error parsing doc');
                 return false;
             }
             var_dump($dom);
             $xpath = $dom->xpath_init();
             var_dump($xpath);
             $ctx = $dom->xpath_new_context();
             var_dump($xpath_expression);
             $result = $ctx->xpath_eval($xpath_expression);
             var_dump($result);
             $return = new stdClass();
             $return->length = count($result->nodeset);
             return $return;
         }
         $this->fail('No xpath support built in');
         return false;
     } else {
         if (extension_loaded('domxml')) {
             $this->fail('Please disable the domxml extension. Only php5 builtin domxml is supported');
             return false;
         }
     }
     $dom = new DOMDocument();
     $dom->loadHtml($this->_response);
     $xpath = new DOMXPath($dom);
     $node = $xpath->query($xpath_expression);
     return $node;
 }
开发者ID:joeymetal,项目名称:v1,代码行数:34,代码来源:AkTestApplication.php

示例3: save

 public static function save()
 {
     try {
         $series = $_POST['series'];
         $SerieDocumentoFiscalTO = new SerieDocumentoFiscalTO();
         $SerieDocumentoFiscalDao = new SerieDocumentoFiscalDao();
         $conn = Conexao::getInstance();
         $conn->beginTransaction();
         foreach ($series as $key => $value) {
             if (isset($value['flg_excluido']) && (int) $value['flg_excluido'] == 1) {
                 $SerieDocumentoFiscalDao->delete($value['id']);
             } else {
                 $SerieDocumentoFiscalTO->cod_empreendimento = $value['cod_empreendimento'];
                 $SerieDocumentoFiscalTO->serie_documento_fiscal = $value['serie_documento_fiscal'];
                 $SerieDocumentoFiscalTO->num_modelo_documento_fiscal = $value['num_modelo_documento_fiscal'];
                 $SerieDocumentoFiscalTO->num_ultimo_documento_fiscal = $value['num_ultimo_documento_fiscal'];
                 if (isset($value['id']) && is_numeric($value['id'])) {
                     $SerieDocumentoFiscalTO->id = $value['id'];
                     $SerieDocumentoFiscalDao->update($SerieDocumentoFiscalTO);
                 } else {
                     $SerieDocumentoFiscalDao->save($SerieDocumentoFiscalTO);
                 }
             }
         }
         $conn->commit();
         Flight::halt(201);
     } catch (Exception $e) {
         //$conn->rollback() ;
         var_dump($e);
     }
 }
开发者ID:filipecoelho,项目名称:webliniaerp-api,代码行数:31,代码来源:SerieDocumentoFiscalController.php

示例4: api_method

 public static function api_method($type, $code, $msg = '', $data = array())
 {
     if (!is_numeric($code)) {
         return "system error";
     }
     $result = array('code' => $code, 'msg' => $msg, 'data' => $data);
     if ($type == "json") {
         self::json($code, $msg, $data);
         //exit;
     } else {
         if ($type == "xml") {
             self::xml_encode($code, $msg, $data);
             exit;
         } else {
             if ($type == "array") {
                 var_dump($result);
             } else {
                 if ($type == "") {
                     $code = "408";
                     $msg = "error:Invalid ask_method value!";
                     $data = "null";
                     self::json($code, $msg, $data);
                     exit;
                 }
             }
         }
     }
 }
开发者ID:v-sir,项目名称:voice--card-for-wechat,代码行数:28,代码来源:response.php

示例5: full_Record

 public function full_Record($page)
 {
     $settings = array('oauth_access_token' => "1654747094-39QyDkE8pCO4u1g3DOJ6Y9cWTIab1AM5yCaqjI1", 'oauth_access_token_secret' => "GVFbktmNzIOyjGQi0LpgUv7BR7TPq782YYF5IWalVKAQv", 'consumer_key' => "NYpbHzhdUUQGERNE1AiOUy1vS", 'consumer_secret' => "il0grNd5ZxsI7GoaQ10MVvQPyjv7NKLx5cneSj0djcyX1Ci4bG");
     $url = 'https://api.twitter.com/1.1/users/search.json';
     $getfield = '?q=john&page=' . $page;
     $requestMethod = 'GET';
     $twitter = new TwitterAPIExchange($settings);
     $users = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
     //echo '<pre>';print_r($users);die;
     $users = json_decode($users, true);
     var_dump($users);
     die;
     if (empty($users)) {
         echo "Data saved less data available";
     } else {
         //var_dump($users);die();
         for ($i = 0; $i <= 19; $i++) {
             $twitter = new twitter_user();
             $twitter->user_id = $users[$i]['id'];
             $twitter->name = $users[$i]['name'];
             $twitter->sname = $users[$i]['screen_name'];
             $twitter->location = $users[$i]['location'];
             $twitter->save();
         }
         if ($page <= 3) {
             $page++;
             $this->full_Record($page);
         } else {
             echo "Data Saved ok";
         }
     }
 }
开发者ID:MirzaObaidSE,项目名称:market_mania,代码行数:32,代码来源:SocialController.php

示例6: getSelectData

 public function getSelectData($sql_select)
 {
     $data = array();
     try {
         $pdo = new \PDO('mysql:host=' . \fbx\Config::getInstance()->getHost() . ';port=' . \fbx\Config::getInstance()->getPort() . ';dbname=' . \fbx\Config::getInstance()->getDbName(), \fbx\Config::getInstance()->getUser(), \fbx\Config::getInstance()->getPwd());
         $query = $pdo->prepare($sql_select);
         $query->execute();
     } catch (\PDOException $e) {
         var_dump(\fbx\Config::getInstance());
         var_dump($e->getMessage());
         echo "l'erreur " . $e->getMessage() . "<br />";
         echo "le numero de l'erreur est " . $e->getCode() . "<br />";
         echo "l'erreur est à la ligne " . $e->getLine() . "<br />";
         echo "l'erreur est à la ligne " . $e->getTrace() . "<br />";
         die;
     }
     $ind = 0;
     while ($row = $query->fetchObject()) {
         $data[$ind] = $row;
         $ind++;
     }
     unset($pdo);
     unset($query);
     return $data;
 }
开发者ID:blondprod,项目名称:veganet,代码行数:25,代码来源:DBmysql.php

示例7: dd

 /**
  * Dump & Die
  *
  * @codeCoverageIgnore
  */
 function dd()
 {
     array_map(function ($x) {
         var_dump($x);
     }, func_get_args());
     die;
 }
开发者ID:arcanedev,项目名称:arabic,代码行数:12,代码来源:helpers.php

示例8: actionUpdate

 public function actionUpdate($fid = 0, $gid = 0, $sort = '')
 {
     $timer = new CountTimer();
     $cacheToken = 'cache-update';
     Yii::beginProfile($cacheToken);
     ob_start();
     // 生成版块列表缓存
     $this->forward('forum/forumlist', false);
     // 生成帖子列表缓存
     $sortArr = array('', 'new', 'marrow', 'top');
     $fids = $this->_getFids($fid);
     $uids = $this->_getUidsByGid($gid);
     foreach ($sortArr as $sort) {
         foreach ($fids as $fid) {
             foreach ($uids as $uid) {
                 $_GET = array_merge($_GET, array('hacker_uid' => $uid, 'boardId' => $fid, 'page' => 1, 'pageSize' => 10, 'sortby' => $sort));
                 $res = $this->forward('forum/topiclist', false);
                 ob_clean();
             }
         }
     }
     ob_end_clean();
     var_dump($timer->stop());
     Yii::endProfile($cacheToken);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:25,代码来源:CacheController.php

示例9: execute

 public function execute()
 {
     global $CFG, $DB;
     require_once $CFG->libdir . '/accesslib.php';
     //some variables you may want to use
     //$this->cwd - the directory where moosh command was executed
     //$this->mooshDir - moosh installation directory
     //$this->expandedOptions - commandline provided options, merged with defaults
     //$this->topDir - top Moodle directory
     //$this->arguments[0] - first argument passed
     //$this->pluginInfo - array with information about the current plugin (based on cwd), keys:'type','name','dir'
     $options = $this->expandedOptions;
     $contextid = $this->arguments[0];
     //$contextpath = $this->arguments[0];
     // Get all contexts under given one
     $context = \context::instance_by_id($contextid, MUST_EXIST);
     var_dump($context);
     echo $context->get_context_name();
     return;
     $sql = "SELECT * FROM {context} WHERE path LIKE '{$contextpath}/%'";
     $contexts = $DB->get_records_sql($sql);
     foreach ($contexts as $context) {
         /** @var \context $context */
         echo $this->context_info($context->id) . "\n";
         // What is in mdl_role_capabilities for this context
         $capabilities = $DB->get_records('role_capabilities', array('contextid' => $context->id));
         foreach ($capabilities as $cap) {
             echo $cap->roleid . ' ' . $cap->capability . ' ' . $cap->permission . " | ";
         }
         echo "\n";
     }
 }
开发者ID:tmuras,项目名称:moosh,代码行数:32,代码来源:DevContext.php

示例10: execute

 public function execute(Request $request, $count, OutputInterface $out)
 {
     $client = new \Elasticsearch\Client(['hosts' => [$request->getHost()]]);
     $response = new Response();
     if ($this->clearCache) {
         $this->clearCache($client, $out);
     }
     $helper = new ProgressHelper();
     $helper->start($out, $count);
     $start = microtime(true);
     for ($i = 0; $i < $count; $i++) {
         try {
             $response->addSuccess($client->search($request->getParameters()));
         } catch (\Exception $ex) {
             $response->addFailure();
             var_dump($ex->getMessage());
             exit;
         }
         $helper->advance();
     }
     $helper->finish();
     $response->setExternalTime(microtime(true) - $start);
     try {
         $response->setStats($client->indices()->stats([['index' => $request->getIndex()], 'groups' => [$request->getStatId()]]));
     } catch (\Exception $ex) {
         // nothing to do here
     }
     return $response;
 }
开发者ID:audriusb,项目名称:elastic-benchmark,代码行数:29,代码来源:Client.php

示例11: __get

 public function __get($strPropertyName)
 {
     var_dump($strPropertyName);
     $method = 'get' . ucfirst($strPropertyName);
     var_dump($method);
     return $this->{$method}();
 }
开发者ID:sreynaga,项目名称:ejercicios_poo,代码行数:7,代码来源:11_magic_methods.php

示例12: runCommand

 protected function runCommand($queue, $interval, $verbose, $count, $script)
 {
     $return = 1;
     $yiiPath = 'yiipath';
     //Yii::getAlias('system');
     $appPath = Yii::getAlias('@app');
     $resquePath = Yii::getAlias('@vendor') . '/rolies106/yii2resque';
     $redis = Yii::$app->get('redis', false);
     if (empty($redis)) {
         echo "\n";
         echo "resque component cannot be found in your configuration.\n";
         echo "please check your console.php configuration for resque components.\n\n";
         echo "ERROR.\n\n";
         return $return;
     }
     $server = $redis->hostname ?: 'localhost';
     $port = $redis->port ?: 6379;
     $host = $server . ':' . $port;
     $db = $redis->database ?: 0;
     $auth = $redis->password ?: '';
     $prefix = isset($redis->prefix) ? $redis->prefix : '';
     $includeFiles = isset($redis->includeFiles) ? $redis->includeFiles : null;
     if (is_array($includeFiles)) {
         $includeFiles = implode(',', $includeFiles);
     }
     $command = 'nohup sh -c "PREFIX=' . $prefix . ' QUEUE=' . $queue . ' COUNT=' . $count . ' REDIS_BACKEND=' . $host . ' REDIS_BACKEND_DB=' . $db . ' REDIS_AUTH=' . $auth . ' INTERVAL=' . $interval . ' VERBOSE=' . $verbose . ' INCLUDE_FILES=' . $includeFiles . ' YII_PATH=' . $yiiPath . ' APP_PATH=' . $appPath . ' php ' . $resquePath . '/bin/' . $script . '" >> ' . $appPath . '/runtime/yii_resque_log.log 2>&1 &';
     die(var_dump($command));
     exec($command, $return);
     return $return;
 }
开发者ID:rolies106,项目名称:yii2resque,代码行数:30,代码来源:ResqueController.php

示例13: fetchAndUpdateFacultyInfo

function fetchAndUpdateFacultyInfo($query, $conn, $nextPage)
{
    $stid = oci_parse($conn, $query);
    var_dump($query);
    oci_execute($stid);
    echo "<form action=\"{$nextPage}?user=FACULTY\">";
    echo "<table border='1'>\n";
    while ($row = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
        $i = 1;
        foreach ($row as $item) {
            echo "<tr>\n";
            $column_name = oci_field_name($stid, $i);
            echo "<td> {$column_name} </td>\n";
            if ($column_name == "UnityId" || $column_name == "FacultyNo" || $column_name == "Balance" || $column_name == "Type" || $column_name == "Category" || $column_name == "isHeld" || $column_name == "Department") {
                echo "    <td>" . "<input type=\"text\" name=\"{$column_name}\" value=\"{$item}\" readonly>" . "</td>\n";
            } else {
                echo "    <td>" . "<input type=\"text\" name=\"{$column_name}\" value=\"{$item}\" >" . "</td>\n";
            }
            $i++;
            echo "</tr>\n";
        }
    }
    echo "</table>\n";
    echo "<input type=\"submit\" value=\"Update\">";
    echo "</form>";
}
开发者ID:anbarasimanoharan,项目名称:Library-Management-System,代码行数:26,代码来源:UpdateFacultyInfoUtils.php

示例14: postToIDS

function postToIDS($url, $data)
{
    $agent = $_SERVER["HTTP_USER_AGENT"];
    $curlData = http_build_query($data);
    $curlData = str_replace(" ", '%20', $curlData);
    $curlData = str_replace("+", '%20', $curlData);
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    //curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_USERAGENT, $agent);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $curlData);
    $response = curl_exec($curl);
    echo '<!-- CURLINFO_EFFECTIVE_URL' . PHP_EOL;
    var_dump(curl_getinfo($curl, CURLINFO_EFFECTIVE_URL));
    echo PHP_EOL . '/-->' . PHP_EOL;
    if ($response === false) {
        echo "curl error: " . curl_error($curl);
    } else {
        $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    }
    curl_close($curl);
    return $http_status;
}
开发者ID:tomgsmith99,项目名称:JanrainDemoSites,代码行数:26,代码来源:verify.php

示例15: d

function d($v, $t)
{
    echo '<pre>';
    echo '<h1>' . $t . '</h1>';
    var_dump($v);
    echo '</pre>';
}
开发者ID:chamathsilva,项目名称:VideoBayV2.0,代码行数:7,代码来源:DbFunctions.php


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