• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP prettyPrint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: dwbn_get_page

function dwbn_get_page($token, $page_uri)
{
    //Bind global variables
    global $oauth2_host;
    //Get full uri
    $uri = "https://" . $oauth2_host . $page_uri;
    //Connect via curl
    $ch = curl_init($uri);
    //Disable sertificates check for HTTPS
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    //Show or not recieve header
    curl_setopt($ch, CURLOPT_HEADER, false);
    //Show or not sent header - will be presented by curl_getinfo()
    curl_setopt($ch, CURLINFO_HEADER_OUT, true);
    //Header is here
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: ' . $oauth2_host, "Authorization: Bearer " . $token));
    //Return result to variable
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    //Exec curl command
    $answer_json = curl_exec($ch);
    //Prepare JSON to show
    $answer_json_pretty = prettyPrint($answer_json);
    //Put info into variable
    $curl_getinfo = curl_getinfo($ch);
    //Close curl connection
    curl_close($ch);
    //Ruturn
    return array('curl_getinfo' => $curl_getinfo, 'answer_json' => $answer_json, 'answer_json_pretty' => $answer_json_pretty);
}
开发者ID:jsib,项目名称:curl,代码行数:30,代码来源:dwbn.php


示例2: dwbn_get_page

function dwbn_get_page($token, $page_uri)
{
    //Bind global variables
    global $oauth2_host;
    //Get full uri
    $uri = "https://" . $oauth2_host . $page_uri;
    //Connect using Google App Engine URL Fetch service
    $context = ['http' => ['method' => 'GET', 'header' => "Host: {$oauth2_host}\r\n" . "Authorization: Bearer " . $token . "\r\n"]];
    $context = stream_context_create($context);
    //Get answer from DWBN
    $answer_json = file_get_contents($uri, false, $context);
    //Prepare JSON to show
    $answer_json_pretty = prettyPrint($answer_json);
    //Ruturn
    return array('answer_json' => $answer_json, 'answer_json_pretty' => $answer_json_pretty);
}
开发者ID:dwbru,项目名称:guide-notify,代码行数:16,代码来源:dwbn.php


示例3: exportSongs

function exportSongs()
{
    $db_connection = new mysqli('stardock.cs.virginia.edu', 'cs4750ams5daa', 'music', 'cs4750ams5da');
    if (mysqli_connect_errno()) {
        echo "Connection Error!";
        return;
    }
    /*	header('Content-type: text/xml');       
    	$data = '<?xml version="1.0" encoding="utf-8"?>';      
    	$data .= "<ReturnType><Data>Here is some data</Data></ReturnType>";       
    	echo "$data"; */
    $var = array();
    $sql = "SELECT * FROM Songs";
    $result = mysqli_query($db_connection, $sql);
    while ($obj = mysqli_fetch_object($result)) {
        $var[] = $obj;
    }
    header('Content-Type: application/json; charset=utf-8');
    $jsonStr = json_encode($var);
    echo '{"Songs":' . prettyPrint($jsonStr) . '}';
    //echo $jsonStr;
}
开发者ID:ew7wc,项目名称:ListenUp,代码行数:22,代码来源:exportSongsData.php


示例4: prettyPrint

// Update an urban word that does not exist
// Throws an exception - Urban Word not found
//$urbanWordsManager->updateUrbanWord("TGIF", "Thank God It's Free", "OMG, TGIF");
echo '<h4>Updated Urban Word</h4>';
prettyPrint($updatedUrbanWord);
// Delete an Urban Word
$urbanWordsManager->deleteUrbanWord($slang3);
// Delete an Urban Word that does not exist
// Throws an exception
// $urbanWordsManager->deleteUrbanWord("Ganga");
echo '<h4>Result after deleting one of the Urban Words</h4>';
prettyPrint(UrbanWordsManager::$data);
// This section tests the WordsGroup Class
$sentence = "let us pretend Marhsal Mathers never picked up a pen, let us pretend things would have been no different, pretend he procrastinated had no motivation, pretend he just made excuses that were so paper thin.";
// The group function groups the words in the given
// statement into an associative array
$grouped = WordsGroup::group($sentence);
echo '<h3>Grouped Words Example</h3>';
echo '<h5>Original Sentence</h5>';
echo $sentence;
echo '<h5>Grouped</h5>';
prettyPrint($grouped);
/**
 * Hepler function to pretty print the data variables
 */
function prettyPrint($array)
{
    echo '<pre>';
    print_r((array) $array);
    echo '</pre>';
}
开发者ID:gangachris,项目名称:cp1-php,代码行数:31,代码来源:index.php


示例5: apiReturnError

} else {
    if ($group_id) {
        // Attempt to load action permits for the specified group.
        if (!($results = loadGroupActionPermits($group_id))) {
            apiReturnError($ajax, getReferralPage());
        }
    } else {
        if ($all == "users") {
            // Attempt to load action permits for all users
            if (!($results = loadUserActionPermits("all"))) {
                apiReturnError($ajax, getReferralPage());
            }
        } else {
            if ($all == "groups") {
                // Attempt to load action permits for all groups
                if (!($results = loadGroupActionPermits("all"))) {
                    apiReturnError($ajax, getReferralPage());
                }
            } else {
                addAlert("danger", "user_id, group_id, or all must be specified.");
                apiReturnError($ajax, getReferralPage());
            }
        }
    }
}
restore_error_handler();
if ($pretty) {
    echo prettyPrint(json_encode($results, JSON_PRETTY_PRINT));
} else {
    echo json_encode($results);
}
开发者ID:Vaibhav95g,项目名称:Bitsmun-user-management-portal,代码行数:31,代码来源:load_action_permits.php


示例6: str_repeat

                }
            }
        }
        if ($new_line_level !== NULL) {
            $result .= "\n" . str_repeat("\t", $new_line_level);
        }
        $result .= $char . $post;
    }
    return $result;
}
/* eat question mark and go from there */
$qs = $_SERVER['QUERY_STRING'];
if ($qs[0] == '?') {
    $qs = substr($qs, 1);
}
switch ($qs) {
    case 'ip':
        _h_json();
        echo prettyPrint(json_encode($_SERVER['REMOTE_ADDR']));
        return true;
    case 'headers':
        _h_json();
        $headers = apache_request_headers();
        echo prettyPrint(json_encode($headers));
        return true;
    default:
        define('C64LEGIT', true);
        return include 'redirector.php';
}
//unhandled
return false;
开发者ID:nextraztus,项目名称:c64xyz,代码行数:31,代码来源:router.php


示例7: prettyPrint

<?php

$style = new \Drupal\livesource\ArtistStyle(26);
$eventFormat = new \Drupal\livesource\EventFormatter($style);
$result = $eventFormat->setArtist()->formattedResults();
print prettyPrint(json_encode($result)) . "\n";
function prettyPrint($json)
{
    $result = '';
    $level = 0;
    $in_quotes = false;
    $in_escape = false;
    $ends_line_level = NULL;
    $json_length = strlen($json);
    for ($i = 0; $i < $json_length; $i++) {
        $char = $json[$i];
        $new_line_level = NULL;
        $post = "";
        if ($ends_line_level !== NULL) {
            $new_line_level = $ends_line_level;
            $ends_line_level = NULL;
        }
        if ($in_escape) {
            $in_escape = false;
        } else {
            if ($char === '"') {
                $in_quotes = !$in_quotes;
            } else {
                if (!$in_quotes) {
                    switch ($char) {
                        case '}':
开发者ID:adam-s,项目名称:954live,代码行数:31,代码来源:test.php


示例8: str_replace

        }
        $result .= $char . $post;
        $prev_char = $char;
    }
    return $result;
}
?>

<form action="<?php 
echo Route::url('index.php?option=' . $this->option);
?>
" method="post" name="adminForm" id="adminForm">

	<table class="adminlist">
		<tbody>
			<tr>
				<td>
<pre>
<?php 
echo str_replace("\t", ' &nbsp; &nbsp;', prettyPrint(json_encode($this->output)));
?>
</pre>
				</td>
			</tr>
		</tbody>
	</table>

	<?php 
echo Html::input('token');
?>
</form>
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:run.php


示例9: set_config

 /**
  * Set miner config.
  * 
  * @param array $data
  *   The orig data from phpminer. (Optional, default = array())
  */
 public function set_config($data = array())
 {
     // Get current cgminer config.
     $conf = json_decode(file_get_contents($this->config['cgminer_config_path']), true);
     // When the value is empty, we have to remove it from the cgminer config.
     if (empty($data['value'])) {
         if (isset($conf[$data['key']])) {
             unset($conf[$data['key']]);
         }
     } else {
         // When we have a gpu key, then we have a multi value field. This means values can be seperated by , (comma).
         if (isset($data['gpu'])) {
             // If config key doesn't exist yet, create it.
             if (!isset($conf[$data['key']])) {
                 $conf[$data['key']] = '';
             }
             // Get current config values per gpu.
             $config_values = explode(",", $conf[$data['key']]);
             // If there are no config values yet, create an empty array.
             if (empty($config_values)) {
                 $config_values = array();
             }
             // Get the provided values, which should be set per gpu.
             $device_values = array();
             if (isset($data['current_values']) && !empty($data['current_values'])) {
                 $device_values = explode(",", $data['current_values']);
                 if (empty($device_values)) {
                     $device_values = array();
                 }
             }
             // Get the device count, so we can create the correct comma seperated value.
             $device_count = $data['devices'];
             // Loop through each device.
             for ($i = 0; $i < $device_count; $i++) {
                 // If the config key does not exist, fill it with 0.
                 if (!isset($config_values[$i])) {
                     $config_values[$i] = !isset($device_values[$i]) ? 0 : $device_values[$i];
                 }
             }
             // Set the given gpu value.
             $config_values[$data['gpu']] = $data['value'];
             // Get the end result of the config key with all gpu values.
             $conf[$data['key']] = implode(",", $config_values);
         } else {
             // Parse "true" to boolean true
             if ($data['value'] === 'true') {
                 $data['value'] = true;
             }
             // Parse "false" to boolean false
             if ($data['value'] === 'false') {
                 $data['value'] = false;
             }
             // Set new config key value.
             $conf[$data['key']] = $data['value'];
         }
     }
     // Try to store the new config.
     if (file_put_contents($this->config['cgminer_config_path'], str_replace('\\/', '/', prettyPrint(json_encode($conf)))) === false) {
         throw new Exception('Could not write config file');
     }
 }
开发者ID:javascriptit,项目名称:phpminer,代码行数:67,代码来源:RPCClientApi.class.php


示例10: mysql_query

    <table align="center">
    <tr>
      <th>Event ID</th>
      <th>Payload</th>
    </tr>
    <?php 
$sql_query = "SELECT * FROM events";
$result_set = mysql_query($sql_query);
while ($row = mysql_fetch_row($result_set)) {
    ?>
              <tr>
              <td><?php 
    echo $row[0];
    ?>
</td>
              <td><?php 
    echo prettyPrint($row[1]);
    ?>
</td>
              </tr>
    <?php 
}
?>
    </table>
    </div>
</div>

</center>
</body>
</html>
开发者ID:jcarcamo,项目名称:webhook_test,代码行数:30,代码来源:index.php


示例11: ParseMap


//.........这里部分代码省略.........
        }
        if (!is_array($gtdata['controlpoint'])) {
            $map['gametypes'][$gtname]['controlpoint'] = array($gtdata['controlpoint']);
        }
        $cps = $map['gametypes'][$gtname]['controlpoint'];
        //Process any entities in the gamedata text file.
        $entlist = array();
        if (!isset($gtdata[$entities_key])) {
            continue;
        }
        foreach ($gtdata[$entities_key] as $entname => $entity) {
            //var_dump($entname,$entity);
            //KV reader now handles multiple like-named resources by creating a numerically indexed array
            //When doing that, the is_multiple_array flag is set
            if (isset($entity['is_multiple_array'])) {
                //If multiple items, send each to the array
                foreach ($entity as $subent) {
                    if (is_array($subent)) {
                        $subent['classname'] = $entname;
                        $entlist[] = CreatePoint($subent, $map);
                    }
                }
            } else {
                //Otherwise, pack the single item
                $entity['classname'] = $entname;
                $entlist[] = CreatePoint($entity, $map);
            }
        }
        //Process all gamedata entities that are referenced by the controlpoints list
        foreach ($entlist as $id => $entity) {
            if (!isset($entity['pos_name'])) {
                continue;
            }
            $cp = $entity['pos_name'];
            //(isset($entity['controlpoint'])) ? $entity['controlpoint'] : $entity['targetname'];
            foreach ($entity as $key => $val) {
                if (!isset($map['gametypes'][$gtname][$points_key][$cp][$key]) || @$entity['targetname'] == $cp && $key != 'classname' || @$entity['targetname'] != $cp && $key == 'classname') {
                    $map['gametypes'][$gtname][$points_key][$cp][$key] = $val;
                }
            }
        }
        /*
        		//chr 65 is uppercase A. This lets me 'increment' letters
        		$chr = 65;
        		// Loop through control points and name them
        		foreach ($cps as $idx => $cp) {
        			$cpname = chr($chr);
        			unset($map['gametypes'][$gtname]['controlpoint'][$idx]);
        			$map['gametypes'][$gtname]['controlpoint'][$cpname] = (isset($map['gametypes'][$gtname][$points_key][$cp])) ? $map['gametypes'][$gtname][$points_key][$cp] : $map[$points_key][$cp];
        			//Set point name to the letter of the objective
        			//$map['gametypes'][$gtname][$points_key][$cp]
        			$map['gametypes'][$gtname]['controlpoint'][$cpname]['pos_name'] = $cpname;
        			if (isset($gtdata['attackingteam'])) {
        				$map['gametypes'][$gtname]['controlpoint'][$cpname]['pos_team'] = ($gtdata['attackingteam'] == 'security') ? 3 : 2;
        			}
        			$chr++;
        		}
        */
        //Bullshit to add teams to points, Skirmish game logic does it instead of saving it in the maps.
        if ($gtname == 'skirmish') {
            $map['gametypes'][$gtname]['controlpoint']['B']['pos_team'] = 2;
            $map['gametypes'][$gtname]['controlpoint']['D']['pos_team'] = 3;
        }
        //Same deal for Firefight
        if ($gtname == 'firefight') {
            $map['gametypes'][$gtname]['controlpoint']['A']['pos_team'] = 2;
            $map['gametypes'][$gtname]['controlpoint']['C']['pos_team'] = 3;
        }
        /*
        		//Parse spawn zones. This is tricky because there will usually be two zones with the same targetname
        		// but different teamnum. This is to allow spawning to move as the game changes I believe.
        		if (isset($gtdata['spawnzones'])) {
        			foreach ($gtdata['spawnzones'] as $szid => $szname) {
        				if (is_numeric($szid)) {
        					unset($map['gametypes'][$gtname]['spawnzones'][$szid]);
        					$sz = array();
        					foreach (array('_team2','_team3') as $suffix) {
        						if (isset($map[$points_key]["{$szname}{$suffix}"]))
        							$sz["{$szname}{$suffix}"] = $map[$points_key]["{$szname}{$suffix}"];
        					}
        					$map['gametypes'][$gtname]['spawnzones'][$szname] = $sz;
        				}
        			}
        		}
        		// Remove the points and entities sections from the finished data structure. We no longer need them.
        		if (@is_array($map['gametypes'][$gtname][$points_key])) {
        			unset($map['gametypes'][$gtname][$points_key]);
        		}
        		if (@is_array($map['gametypes'][$gtname][$entities_key])) {
        			unset($map['gametypes'][$gtname][$entities_key]);
        		}
        */
        //echo "done parse gametypes\n";
    }
    recur_ksort($map);
    $json = prettyPrint(json_encode($map));
    file_put_contents($dstfile, $json);
    echo "OK: Parsed {$mapname}{$linebreak}";
    //	var_dump(array_merge_recursive($srcfiles,$map['source_files']));
}
开发者ID:jaredballou,项目名称:insurgency-tools-old,代码行数:101,代码来源:mapdata.php


示例12: cURL

function cURL($jsonString)
{
    $protocol = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
    $options = array("url" => $protocol . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/../public/index.php");
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $options["url"]);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($jsonString)));
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonString);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    $result = curl_exec($ch);
    curl_close($ch);
    $res = prettyPrint($result, "API Response : ");
    echo "<br/><br/>";
    echo $res;
}
开发者ID:fica990,项目名称:jsonapi,代码行数:18,代码来源:APIcalls.php


示例13: GetServer

function GetServer($host, $port, $region = '', $cacheonly = 1, $forcerefresh = 0)
{
    global $paths, $columns, $server_file_maxage, $tag_values;
    $ip = gethostbyname($host);
    $server = array('region' => $region, 'info' => array('serverName' => "<b>[LOADING]</b>{$ip}:{$port}", 'mapName' => '', 'numberOfPlayers' => 0, 'maxPlayers' => 0, 'serverTags' => ''), 'tags' => array('g' => '', 'p' => '', 't' => '', 'pure' => ''), 'ipAddress' => $ip, 'port' => $port);
    /*
    	foreach ($columns as $column) {
    		if (!isset($server[$column])) {
    			$server[$column] = '';
    		}
    	}
    */
    $cache_file = "{$paths['servers']}/{$ip}_{$port}.json";
    // Should we use the cache file?
    if (file_exists($cache_file)) {
        $get_cache = filemtime($cache_file) > time() - $server_file_maxage && !$forcerefresh;
        if ($get_cache || $cacheonly) {
            $cache = json_decode(file_get_contents($cache_file), TRUE);
            $server = array_replace_recursive($server, $cache);
            //var_dump($cache,$server);
            //$server['updated'] = filemtime($cache_file);
            // If server has an error, attempt new fetch
            //$get_cache = (!isset($server['error']));
        }
    }
    // If the cached data is not available or has been invalidated, refresh
    if (!$cacheonly && (!$get_cache || $forcerefresh)) {
        try {
            $connection = new \SteamCondenser\Servers\SourceServer($ip, $port);
            $connection->initialize();
            // Collect data from Steam Condenser
            $server['ping'] = $connection->getPing();
            $server['players'] = $connection->getPlayers();
            $server['rules'] = $connection->getRules();
            $server['info'] = $connection->getServerInfo();
            $tags = array_filter(explode(',', $server['info']['serverTags']));
            foreach ($tags as $tag) {
                $bits = explode(':', $tag, 2);
                if (count($bits) == 2) {
                    $server['tags'][$bits[0]] = $tag_values[$bits[0]][$bits[1]] = $bits[1];
                } else {
                    $server['tags'][$tag] = $tag_values[$tag] = "__";
                }
            }
            $server['updated'] = time();
            file_put_contents($cache_file, prettyPrint(json_encode($server)), LOCK_EX);
        } catch (Exception $e) {
            //			echo 'Caught exception: ',  $e->getMessage(), "\n";
            $server['error'] = $e->getMessage();
            file_put_contents($cache_file, prettyPrint(json_encode($server)), LOCK_EX);
        }
    }
    // Skip processing for servers with errors
    if ($region) {
        $server['region'] = $region;
    }
    return $server;
}
开发者ID:jaredballou,项目名称:insurgency-tools-old,代码行数:58,代码来源:index.php


示例14: fgets

    $line = fgets($file);
    echo $line . "<br>";
}
fclose($file);
?>
</code></pre>


              <p>Result:</p>

              <pre><code class="language-json"><?php 
$sample = explode(",", $response_json);
$sample = array_slice($sample, 0, 19);
$sample = implode(",", $sample);
$sample = str_replace("\\", "", $sample);
echo prettyPrint($sample);
?>

      ...     </code></pre>

              <p>If you want the result in standard php object, just decode it:</p>

              <pre><code class="language-php">$response = json_decode( $response_json );
//Prints the first item's text:
echo $response->data[0]->text;</code></pre>


              <h2>Notes</h2>

              <h3>Authentication</h3>
开发者ID:isotopic,项目名称:feed-blender,代码行数:30,代码来源:index.php


示例15: json_encode_helper

 function json_encode_helper($data, $pretty_print = FALSE)
 {
     $ret = json_encode((object) $data);
     $ret = str_replace('\\/', '/', $ret);
     if ($pretty_print) {
         $ret = prettyPrint($ret);
     }
     return $ret;
 }
开发者ID:JackSzwergold,项目名称:ASCII-PHP,代码行数:9,代码来源:Mosaic.class.php


示例16: json_decode

        $AccountPrivileges = $row['AccountPrivileges'];
        $LastUpdateTime = $row['LastUpdateTime'];
        $avatar = $row["Avatar"];
        $avatarObj = json_decode($row["Avatar"], true);
        $gameobjects = $row["GameObjects"];
        $gameobjectsObj = json_decode($row["GameObjects"], true);
        $ClanId = $avatarObj['alliance_id'];
        $playerClan = "SELECT clan.ClanId, clan.LastUpdateTime, clan.Data FROM clan WHERE clan.ClanId=" . $ClanId;
        $playerClanResult = $conn->query($playerClan);
        if ($playerClanResult->num_rows > 0) {
            while ($playerClanRow = $playerClanResult->fetch_assoc()) {
                $clanData = json_decode($playerClanRow['Data'], true);
                $playerclan = $playerClanRow['Data'];
            }
        } else {
            $playerclan = "geen clan";
        }
        $players[] = array("PlayerId" => $row['PlayerId'], "AccountStatus" => $row['AccountStatus'], "AccountPrivileges" => $row['AccountPrivileges'], "LastUpdateTime" => $row['LastUpdateTime'], "avatar" => $avatar, "avatarObj" => $avatarObj, "gameobjects" => $gameobjects, "playerclan" => $playerclan, "clanID" => $clanData['alliance_id']);
    }
}
foreach ($players as $player) {
    $playername = $player['avatarObj']['avatar_name'];
    $ClanId = $player['avatarObj']['alliance_id'];
    $th = $player['avatarObj']['townhall_level'] + 1;
    echo "\n\t\t<div id='result'>\n\t\t\t<div id='details'>\n\t\t\t\t<h5>User details</h5>\n\t\t\t\t<ul>\n\t\t\t\t<li>Player id: " . $player["PlayerId"] . "</li>\n\t\t\t\t<li>Player name: " . $playername . "</li>\n\t\t\t\t<li>Town Hall level: " . $th . "</li>\n\t\t\t\t<li>Status: " . $player["AccountStatus"] . "</li>\n\t\t\t\t<li>Server Permissions: " . $player["AccountPrivileges"] . "</li>\n\t\t\t\t<li>Last online " . $player["LastUpdateTime"] . "</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t\t<div id='ta'>\n\t\t\t\t<h5>Clan info " . $playername . "</h5>\n\t\t\t\t<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n\t\t\t\t\t<input type='hidden' name='playerId' value='" . $player["PlayerId"] . "'>\n\t\t\t\t\t<input type='hidden' name='clanID' value='" . $player["clanID"] . "'>\n\t\t\t\t\t<textarea class='styled' name='playerclan'>" . prettyPrint($player['playerclan']) . "</textarea>\n\t\t\t\t\t<input type='submit' value='Update'>\n\t\t\t\t</form>\n\t\t\t</div>\n\t\t\t<div class='avatar-buildings'>\n\t\t\t\t<div class='avatar'>\n\t\t\t\t\t<h5>Avatar " . $playername . "</h5>\n\t\t\t\t\t<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n\t\t\t\t\t\t<input type='hidden' name='playerId' value='" . $player["PlayerId"] . "'>\n\t\t\t\t\t\t<textarea class='styled' name='avatar'>" . prettyPrint($player['avatar']) . "</textarea>\n\t\t\t\t\t\t<input type='submit' value='Update'>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\t<div class='buildings'>\n\t\t\t\t\t<h5>Buildings</h5> \n\t\t\t\t\t<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>\n\t\t\t\t\t\t<input type='hidden' name='playerId' value='" . $player["PlayerId"] . "'>\n\t\t\t\t\t\t<textarea class='styled' name='gameObject'>" . prettyPrint($player['gameobjects']) . "</textarea>\n\t\t\t\t\t\t<input type='submit' value='Update'>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t";
}
$conn->close();
?>
</div>
</body>
</html>
开发者ID:RHITNL,项目名称:Ultrapowa-User-Management,代码行数:31,代码来源:index.php


示例17: base64_encode

$auth = base64_encode("{$CREDENTIALS}");
$soap_do = curl_init("https://americas.universal-api.pp.travelport.com/B2BGateway/connect/uAPI/AirService");
$header = array("Content-Type: text/xml;charset=UTF-8", "Accept: gzip,deflate", "Cache-Control: no-cache", "Pragma: no-cache", "SOAPAction: \"\"", "Authorization: Basic {$auth}", "Content-length: " . strlen($message));
//curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 30);
//curl_setopt($soap_do, CURLOPT_TIMEOUT, 30);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($soap_do, CURLOPT_POST, true);
curl_setopt($soap_do, CURLOPT_POSTFIELDS, $message);
curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true);
// this will prevent the curl_exec to return result and will let us to capture output
$return = curl_exec($soap_do);
$file = "001-" . $Provider . "_AirAvailabilityRsp.xml";
// file name to save the response xml for test only(if you want to save the request/response)
$content = prettyPrint($return, $file);
parseOutput($content);
//print '<br>';
//echo $return;
//print '<br>';
//print_r(curl_getinfo($soap_do));
//Pretty print XML
function prettyPrint($result, $file)
{
    $dom = new DOMDocument();
    $dom->preserveWhiteSpace = false;
    $dom->loadXML($result);
    $dom->formatOutput = true;
    //call function to write request/response in file
    outputWriter($file, $dom->saveXML());
    return $dom->saveXML();
开发者ID:eroluysal,项目名称:travelport-uapi-tutorial-php,代码行数:31,代码来源:phpSample_Air.php


示例18: DisplayModSelection

function DisplayModSelection($compare = 0, $type = 'theater')
{
    $fields = array('mod', 'version', $type);
    $fieldname = $ext = $type;
    $suffix = $compare ? '_compare' : '';
    $js = $vars = $data = array();
    $path = array("{$type}s");
    foreach ($fields as $field) {
        switch ($field) {
            case 'theater':
                $fieldname = 'theaterfile';
                array_unshift($path, 'scripts');
                break;
            case 'map':
                $path = array('resource', 'overviews');
            default:
                $fieldname = $field;
        }
        $data[$field] = $suffix ? $GLOBALS["{$fieldname}{$suffix}"] == $GLOBALS[$fieldname] ? '-' : $GLOBALS["{$fieldname}{$suffix}"] : $GLOBALS[$fieldname];
        echo "{$field}: <select name='{$field}{$suffix}' id='{$field}{$suffix}'></select>\n";
        $vars[$field] = $data[$field];
        $jsf = $field == $type ? 'item' : $field;
        $js[] = "var select_{$jsf}{$suffix} = \$('#{$field}{$suffix}');";
        $js[] = "var cur_{$jsf}{$suffix} = '{$vars[$field]}';";
    }
    // If showing comparison options, put in blank as first entry to denote no comparison
    if ($compare) {
        $vars['data']['-']['-']['-'] = '-';
    }
    // Populate data hash
    foreach ($GLOBALS['mods'] as $mname => $mdata) {
        foreach ($mdata as $vname => $vdata) {
            foreach ($path as $key) {
                if (!isset($vdata[$key])) {
                    continue 2;
                }
                $vdata =& $vdata[$key];
            }
            foreach ($vdata as $tname => $tpath) {
                $bn = preg_replace('/\\.[^\\.]+$/', '', basename($tname));
                if ($type == 'map') {
                    if (!GetDataFile("maps/parsed/{$bn}.json")) {
                        continue;
                    }
                }
                $vars['data'][$mname][$vname][$bn] = $bn;
            }
        }
    }
    ?>
<script type="text/javascript">
jQuery(function($) {
	var data = <?php 
    echo prettyPrint(json_encode($vars['data']));
    ?>
;
	<?php 
    echo implode("\n\t", $js) . "\n";
    ?>

	$(select_mod).change(function () {
		var mod = $(this).val(), vers = data[mod] || [];
		var html =  $.map(Object.keys(vers).sort().reverse(), function(ver){
			return '<option value="' + ver + '">' + ver + '</option>'
		}).join('');
		select_version.html(html);
		select_version.change();
	});

	$(select_version).change(function () {
		var version = $(this).val(), mod = $(select_mod).val(), values = data[mod][version] || [];
		var html =  $.map(Object.keys(values), function(item){
			return '<option value="' + item + '">' + item + '</option>'
		}).join('');
		select_item.html(html);
		select_item.change();
	});
	var html =  $.map(Object.keys(data), function(mod){
		return '<option value="' + mod + '">' + mod + '</option>'
	}).join('');
	select_mod.html(html);
	select_mod.val(cur_mod);
	select_mod.change();
	select_version.val(cur_version);
	select_version.change();
	select_item.val(cur_item);
	select_item.change();
});
</script>
<?php 
}
开发者ID:jaredballou,项目名称:insurgency-tools-old,代码行数:91,代码来源:Stats.php


示例19: prettyPrint

    }
    $file = "003-" . $PROVIDER . "_HotelBookReq.xml";
    // file name to save the request xml for test only(if you want to save the request/response)
    prettyPrint($message, $file);
    //Calling the Pretty Print function
    //
    // Run the request
    //
    $result = runRequest($message);
    // send the request as parameter to the function
    $_SESSION["content"] = $result;
    // if you do not intend to save response in file use this to use the response for further processing
    //call function to pretty print xml
    $file = "003-" . $PROVIDER . "_HotelBookRsp.xml";
    // file name to save the response xml for test only(if you want to save the request/response)
    prettyPrint($result, $file);
    require_once 'bookingConfirmation.php';
}
//Parse the previous response to get the values to populate Request xml
function parseDetailOutput()
{
    //$hotelDetailRsp = file_get_contents('002_HotelDetailRsp.xml'); // Parsing the Hotel Detail Response xml
    $hotelDetailRsp = $_SESSION["content"];
    //use this if response is not saved anywhere else use above variable
    $xml = simplexml_load_String("{$hotelDetailRsp}", null, null, 'SOAP', true);
    if (!$xml) {
        header("Location: http://LocationOfErrorPage/projects/Hotel/error.php");
        // Use the location of the error page
    }
    $Results = $xml->children('SOAP', true);
    foreach ($Results->children('SOAP', true) as $fault) {
开发者ID:eroluysal,项目名称:travelport-uapi-tutorial-php,代码行数:31,代码来源:phpSample_HotelBook.php


示例20: audit

    protected $AProt = "C.AProt";
    public $APub = "C.APub";
    private $CPriv = "C.CPriv";
    protected $CProt = "C.BProt";
    public $CPub = "C.CPub";
    function audit()
    {
        return parent::audit() && isset($this->APriv, $this->AProt, $this->APub, $this->BProt, $this->BPub, $this->CPriv, $this->CProt, $this->CPub);
    }
}
function prettyPrint($obj)
{
    echo "\n\nBefore serialization:\n";
    var_dump($obj);
    echo "Serialized form:\n";
    $ser = serialize($obj);
    $serPrintable = str_replace("", '\\0', $ser);
    var_dump($serPrintable);
    echo "Unserialized:\n";
    $uobj = unserialize($ser);
    var_dump($uobj);
    echo "Sanity check: ";
    var_dump($uobj->audit());
}
echo "-- Test instance of A --\n";
prettyPrint(new A());
echo "\n\n-- Test instance of B --\n";
prettyPrint(new B());
echo "\n\n-- Test instance of C --\n";
prettyPrint(new C());
echo "Done";
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:serialization_objects_011.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pretty_date函数代码示例发布时间:2022-05-15
下一篇:
PHP pretty函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap