本文整理汇总了PHP中HTTP::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::encode方法的具体用法?PHP HTTP::encode怎么用?PHP HTTP::encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP
的用法示例。
在下文中一共展示了HTTP::encode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayAdmin
protected function displayAdmin()
{
$this->checkRedirect();
$ip_list_str = implode("\r\n", $this->phpServerIpList);
$html = <<<EOT
<html>
<head>
<title>PHPServer集群管理</title>
</head>
<body>
<form method="get" action="/admin">
<h3>phpserver集群ip列表</h3>
<textarea name="ip_list" style="width:18em;height:400px">
{$ip_list_str}
</textarea>
<br/>
<input type="submit" name='保存' value='保存'/ >
</form>
</body>
</html>
EOT;
return $this->sendToClient(HTTP::encode($html));
}
示例2: display
protected function display($rsp_data = '', $cost = '', $services = array())
{
$value_data = '';
$class = isset($_POST['class']) ? $_POST['class'] : '';
$func = isset($_POST['func']) ? $_POST['func'] : '';
$rsp_data = !is_scalar($rsp_data) ? var_export($rsp_data, true) : $rsp_data;
$cost = $cost ? round($cost, 5) : '';
// 默认给个测试参数
if (empty($_POST)) {
$class = "";
$func = "";
$_POST['value'][] = '';
}
if (isset($_POST['value'])) {
foreach ($_POST['value'] as $value) {
$value_data .= '<tr><td>参数</td><td><input type="text" name="value[]" style="width:480px;" value=\'' . htmlspecialchars($value, ENT_QUOTES) . '\' autocomplete="off" disableautocomplete/> <a href="javascript:void(0)" onclick="delParam(this)">删除本行</a></td></tr>';
}
} else {
$value_data = '<tr><td>参数</td><td><input type="text" name="value[]" style="width:480px;" value="" /> <a href="javascript:void(0)" onclick="delParam(this)">删除本行</a></td></tr>';
}
$services = json_encode($services);
$display_data = <<<HHH
<html>
<head>
<meta charset=utf-8>
<title>Thrift Rpc test tool</title>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.8/jquery.min.js"></script>
</head>
<body>
<b style="color:red"></b>
</br>
<b>数组使用array(..)格式,bool直接使用true/false,null直接写null</b>
</br>
<form action="" method="post">
<table>
<tr>
<td>类</td>
<td><input id='service_class' type="text" name="class" style="width:480px;" value="{$class}" autocomplete="off" disableautocomplete/></td>
</tr>
<tr>
<td>方法</td>
<td><input id='service_method' type="text" name="func" style="width:480px;" value="{$func}" autocomplete="off" disableautocomplete/></td>
</tr>
<tbody id="parames">
{$value_data}
</tbody>
<tfoot>
<tr>
<td colspan="2"><a href="javascript:void(0)" onclick="addParam()">添加参数</a></td>
</tr>
<tr>
<td colspan="2" align="center">
<input style="padding:5px 20px;" type="submit" value="submit" />
<br>
</td>
</tr>
</tfoot>
</table>
</form>
<b>Return Data: </b><pre>{$rsp_data}</pre><br>
<br><br>
\t<table>
<tr>
<td>
</td>
<td width=24px>
</td>
<td>
</td>
</tr>
</table>
<b>耗时:</b>{$cost}秒
<div id='service' style="position:absolute;left:200;display:none"></div>
<script type="text/javascript">
var services = {$services};
function addParam(value , auto ) {
var style = auto ? 'width:480px;color:#BBBBBB' : 'width:480px;';
var auto_flag = auto ? 'auto="true"' : '';
value = value ? value : '';
\$('#parames').append('<tr><td>参数</td><td><input class="service_param" type="text" name="value[]" style="'+style+'" value="'+value+'" '+auto_flag+'/> <a href="javascript:void(0)" onclick="delParam(this)">删除本行</a></td></tr>');
}
function delParam(obj) {
\$(obj).parent('td').parent('tr').remove();
}
var last_input_id = '';
\$(document).click(
function(event)
{
var div = \$("#service");
var e = \$(event.target);
// 处理类
if(e.attr('id') && e.attr('id') == 'service_class')
{
\$.ajax({
type: "get",
dataType: "json",
//.........这里部分代码省略.........
示例3: display
//.........这里部分代码省略.........
}
$post_address = '127.0.0.1:2201';
if (isset($_POST['address'])) {
$post_address = $_POST['address'];
}
$address_data = '<tr><td>地址:</td><td>
<select name="address">';
$address_array = $this->getAddress();
foreach ($address_array as $address => $address_and_name) {
$selected = $address == $post_address ? 'selected="selected"' : '';
$address_data .= '<option value ="' . $address . '" ' . $selected . '>' . $address_and_name . '</option>';
}
$address_data .= '
</select>
</td></tr>';
if (isset($_POST['value'])) {
foreach ($_POST['value'] as $value) {
$value_data .= '<tr><td>参数</td><td><input type="text" name="value[]" style="width:480px;" value=\'' . htmlspecialchars($value, ENT_QUOTES) . '\' /> <a href="javascript:void(0)" onclick="delParam(this)">删除本行</a></td></tr>';
}
} else {
$value_data = '<tr><td>参数</td><td><input type="text" name="value[]" style="width:480px;" value="" /> <a href="javascript:void(0)" onclick="delParam(this)">删除本行</a></td></tr>';
}
$display_data = <<<HHH
<html>
<head>
<meta charset=utf-8>
<title>Rpc test tool</title>
<script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.8/jquery.min.js"></script>
</head>
<body>
<b style="color:red">{$msg}</b>
</br>
<b>数组使用array(..)格式,bool直接使用true/false,null直接写null</b>
</br>
<form action="" method="post">
<table>
{$address_data}
<tr>
<td>类</td>
<td><input type="text" name="class" style="width:480px;" value="{$class}" /></td>
</tr>
<tr>
<td>方法</td>
<td><input type="text" name="func" style="width:480px;" value="{$func}" /></td>
</tr>
<tbody id="parames">
{$value_data}
</tbody>
<tfoot>
<tr>
<td colspan="2"><a href="javascript:void(0)" onclick="addParam()">添加参数</a></td>
</tr>
<tr>
<td colspan="2" align="center">
<input style="padding:5px 20px;" type="submit" value="submit" />
<br>
</td>
</tr>
</tfoot>
</table>
</form>
<b>Return Data: </b><pre>{$rsp_data}</pre><br>
<b>Request Text:</b><br>
<form action="" method="post">
<textarea style="width:98%;height:120px" name="req_data">{$req_text}</textarea><br>
<input style="padding:5px 20px;" type="submit" value="submit" />
</form>
<br><br>
\t<table>
<tr>
<td>
</td>
<td width=24px>
</td>
<td>
</td>
</tr>
</table>
<b>Return Text:</b><br>
<textarea style="width:98%;height:300px">{$rsp_text}</textarea><br>
<br>
<b>耗时:</b>{$cost}秒
<script type="text/javascript">
function addParam() {
\$('#parames').append('<tr><td>参数</td><td><input type="text" name="value[]" style="width:480px;" value="" /> <a href="javascript:void(0)" onclick="delParam(this)">删除本行</a></td></tr>');
}
function delParam(obj) {
\$(obj).parent('td').parent('tr').remove();
}
</script>
</body>
</html>
HHH;
$this->sendToClient(HTTP::encode($display_data));
}