本文整理汇总了PHP中HTTP::header方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::header方法的具体用法?PHP HTTP::header怎么用?PHP HTTP::header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTP
的用法示例。
在下文中一共展示了HTTP::header方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createExelFile
public function createExelFile($filename)
{
$this->disableDebugAndLayout();
HTTP::header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
HTTP::header('Content-Disposition: attachment;filename="' . $filename . '"');
HTTP::header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;
}
示例2: __call
public function __call($method, $args)
{
$url = (defined('PHPFOX_API_URL') ? PHPFOX_API_URL : 'http://api.phpfox.com/') . $method;
$Http = new HTTP($url);
$Http->auth($this->_id, $this->_key);
if (\Phpfox::isTrial()) {
$Http->header('PHPFOX_IS_TRIAL', '1');
}
$Http->using(['domain' => \Phpfox::getParam('core.path')]);
$Http->using(['version' => \Phpfox::VERSION]);
foreach ($args as $key => $value) {
if (is_string($value)) {
// $value = [$key => $value];
}
$Http->using($value);
}
return $Http->post();
}
示例3: _status
/**
* Status
* Retorna el estado actual del sitio web
*
* @return true
* ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
* @author Luis Gdonis <ldonis.emc2@gmail.com>
* @since 2.0.0.0-alpha
*/
private function _status()
{
HTTP::header('json');
echo json_encode(Configure::read('info'));
}
示例4: date_default_timezone_set
<?php
date_default_timezone_set('Europe/Sofia');
//if(!isset($_GET['yegler'])){die('...');}
if (isset($_GET['refresh'])) {
HTTP::header("Refresh: 2; ");
}
var_dump($_ENV);
?>
<a name="top"></a>
<form action="#bottom" method="POST" style="position:fixed;top:0px;left:0px;padding:3px 7px; background-color: white; color:000;">
regex:<input type="text" name="regex" value="<?php
echo isset($_POST['regex']) ? $_POST['regex'] : '';
?>
" />
lines:<input type="text" name="n" value="<?php
echo isset($_POST['n']) ? $_POST['n'] : '';
?>
" style='width:50px;'/>
<input type="submit" value="GO" />
<input type="button" value="clear" onclick="javascript:window.location.reload();" />
</form>
<a href="<?php
echo isset($_GET['refresh']) ? '/' : '/?refresh';
?>
" style="position:fixed;top:0px;left:520px;padding:3px 7px; background-color: white;">Auto Refresh: <?php
echo isset($_GET['refresh']) ? '0n' : 'Off';
?>
</a>
<a href="#top" style="position:fixed;bottom:0px;right:0px;padding:3px 7px; background-color: white;">top</a>
示例5: putExtraInfo
/**
* Put additional information on an alternative channel (eg: http headers or stderr).
* Fluent interface.
*
* @param string $type
* @param string $value
* @return RPC_Server_XMLRPC
*/
public function putExtraInfo($type, $value)
{
if (!isset($this->altStream)) {
HTTP::header("{$type}: {$value}", false);
} else {
$sxml = new SimpleXMLElement(xmlrpc_encode($value));
fwrite($this->altStream, "<extraInfo><type>" . htmlentities($type) . "</type>" . $sxml->param->value->asXML() . "</extraInfo>");
}
return $this;
}
示例6: do_thumbnail_http_header
function do_thumbnail_http_header()
{
$offset = 60 * 60 * 24 * 30 * 12;
// 1 year
HTTP::header(array('Pragma' => 'private', 'Cache-Control' => 'private, max-age=' . $offset, 'Expires' => gmdate('D, d M Y H:i:s', time() + $offset) . ' GMT'));
}
示例7: write
/**
* Log a message.
*
* @param string $message
* @param string $type
*/
protected function write($args)
{
$type = !empty($args['type']) ? $args['type'] : "Log";
HTTP::header('X-' . ucfirst(strtolower($type)) . '-' . ++self::$counter . ': ' . str_replace(array("/r", "/n", "/t"), " ", $this->getLine($args)));
}
示例8: dealProcess
/**
* 处理业务逻辑 查询log 查询统计信息
* @see PHPServerWorker::dealProcess()
*/
public function dealProcess($recv_str)
{
HTTP::decode($recv_str);
$module = isset($_GET['module']) ? trim($_GET['module']) : '';
$interface = isset($_GET['interface']) ? trim($_GET['interface']) : '';
$start_time = isset($_GET['start_time']) ? trim($_GET['start_time']) : '';
$end_time = isset($_GET['end_time']) ? trim($_GET['end_time']) : '';
// 管理员
if (0 === strpos($_SERVER['REQUEST_URI'], '/admin')) {
return $this->admin();
} elseif (0 === strpos($_SERVER['REQUEST_URI'], '/html')) {
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
HTTP::header("HTTP/1.1 304 Not Modified");
return $this->sendToClient(HTTP::encode(''));
}
$modified_time = date('D, d M Y H:i:s');
$base_name = basename($_SERVER['REQUEST_URI']);
switch ($base_name) {
case 'highcharts.js':
HTTP::header("Content-Type: application/javascript");
HTTP::header("Last-Modified: {$modified_time}");
return $this->sendToClient(HTTP::encode(self::$hichart));
case 'jquery.min.js':
HTTP::header("Content-Type: application/javascript");
HTTP::header("Last-Modified: {$modified_time}");
return $this->sendToClient(HTTP::encode(self::$jquery));
default:
HTTP::header("HTTP/1.1 404 Not Found");
return $this->sendToClient(HTTP::encode(''));
}
} elseif (0 === strpos($_SERVER['REQUEST_URI'], '/log')) {
$this->checkRedirect();
$right_str = '';
$code = isset($_GET['code']) ? $_GET['code'] : '';
$msg = isset($_GET['msg']) ? $_GET['msg'] : '';
$pointer = isset($_GET['pointer']) ? $_GET['pointer'] : '';
$count = isset($_GET['count']) ? $_GET['count'] : 5;
$log_data_arr = $this->getStasticLog($module, $interface, $start_time, $end_time, $code, $msg, $pointer, $count);
$log_data_str = '';
unset($_GET['ip']);
unset($_GET['pointer']);
foreach ($log_data_arr as $address => $log_data) {
list($ip, $port) = explode(':', $address);
$str = str_replace('source_ip:', 'client_ip:', $log_data['data']);
$log_data_str .= preg_replace('/t?arget_ip:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', 'server_ip:' . $ip . "<br/>", $str);
$_GET['ip'][] = $ip;
$_GET['pointer'][] = $log_data['pointer'];
}
// 过滤掉用户名密码
$log_data_str = preg_replace(array('/([^#]*?Db[a-zA-Z]*Connection[^#]*?[construct|connect]\\()([^)]*?),([^)]*?),([^)]*?)(,[^)]*?\\))/i', '/(REQUEST_DATA:.*?)"password":"([^"]*?)"/'), array('${1}${2}, ****, ****$5', '$1"password":"****"'), $log_data_str);
unset($_GET['end_time']);
$next_page_url = http_build_query($_GET);
$log_data_str .= "</br><center><a href='/log/?{$next_page_url}'>下一页</a></center>";
return $this->display(nl2br($log_data_str));
} else {
$this->checkRedirect();
// 首页
if (empty($module)) {
return $this->home();
} else {
if ($interface) {
return $this->displayInterface($module, $interface, $start_time, $end_time);
} else {
$this->multiRequestStAndModules($module);
return $this->display();
}
}
}
return $this->display();
}
示例9: redirect
public static function redirect($url, $moved = false)
{
if ($moved) {
HTTP::header($_SERVER['SERVER_PROTOCOL'] . ' 301 Moved Permanently', true, 301);
}
if (strlen($url) > 0) {
HTTP::header("Location: " . $url);
} else {
HTTP::header("Location: " . Router::$URI);
}
exit;
}
示例10: clear
/**
* 清除header
* @return void
*/
public static function clear()
{
self::$header = array();
}