选择语言 :

Core_HttpIO

Http输入输出

常量
HttpIO::PARAM_TYPE_URL string(3) "url"
HttpIO::PARAM_TYPE_OLDDATA string(3) "old"
HttpIO::METHOD null
HttpIO::PROTOCOL null
HttpIO::REFERRER null
HttpIO::USER_AGENT empty
HttpIO::IP null
HttpIO::IS_AJAX bool false

API - Core_HttpIO

author
呼吸二氧化碳 jonwang@myqee.com
category
MyQEE
package
System
subpackage
Core
copyright
Copyright © 2008-2013 myqee.com
license
http://www.myqee.com/license.html

$this->__construct( )


HttpIO::setup( )

执行初始化,只执行一次


HttpIO::auto_add_ajax_control_allow_origin( )

自动添加HTML5的AJAX跨越支持


HttpIO::GET( $key = null, $type = null)

获取$_GET数据

    // 获取原始数据
    $get_array = HttpIO::GET(null,HttpIO::PARAM_TYPE_OLDDATA);

    // 获取原始数据为URL格式
    $url = HttpIO::GET('url',HttpIO::PARAM_TYPE_URL);

参数列表

参数 类型 描述 默认值
$key string $key null
$type string 返回类型,false或不传,则返回原始数据 例:HttpIO::PARAM_TYPE_URL null

HttpIO::POST( $key = null, $type = null)

获取$_POST数据

参数列表

参数 类型 描述 默认值
$key string $key null
$type string 返回类型,false或不传,则返回原始数据 例:HttpIO::PARAM_TYPE_URL null

HttpIO::COOKIE( $key = null, $type = null)

获取$_COOKIE数据

参数列表

参数 类型 描述 默认值
$key string $key null
$type string 返回类型,false或不传,则返回原始数据 例:HttpIO::PARAM_TYPE_URL null

HttpIO::REQUEST( $key = null, $type = null)

获取$_REQUEST数据

参数列表

参数 类型 描述 默认值
$key string $key null
$type string 返回类型,false或不传,则返回原始数据 例:HttpIO::PARAM_TYPE_URL null

HttpIO::_get_format_data( )


HttpIO::sanitize( $str )

对字符串进行安全处理

参数列表

参数 类型 描述 默认值
$str $str

HttpIO::sanitize_decode( $str )

对字符串进行反向安全处理

参数列表

参数 类型 描述 默认值
$str $str

HttpIO::redirect( $url , $code = 302)

页面跳转

参数列表

参数 类型 描述 默认值
$url string Redirect location
$code integer Status code: 301, 302, etc integer 302
返回值
  • void

HttpIO::set_cache_header( $time = 86400)

页面输出header缓存

0表示不缓存

参数列表

参数 类型 描述 默认值
$time int 缓存时间,单位秒 integer 86400

HttpIO::_key_string( )


HttpIO::send_headers( )

发送header数据


HttpIO::add_header( $key , $value )

添加header头信息

参数列表

参数 类型 描述 默认值
$key string $key
$value string $value

HttpIO::status( $status = null)

设置HTTP的状态

参数列表

参数 类型 描述 默认值
$status int $status null

HttpIO::current_controller( )

获取当前控制器

返回值
  • Controller

HttpIO::param( $key = null, $default = null)

获取当前页指定参数

$id = $request->param('id');

参数列表

参数 类型 描述 默认值
$key string Key of the value null
$default mixed Default value if the key is not set null
返回值
  • mixed

HttpIO::query( $params = null)

返回query构造参数

参数列表

参数 类型 描述 默认值
$params array Array of GET parameters null
返回值
  • string

HttpIO::uri( $params = null)

获取新的URI

参数列表

参数 类型 描述 默认值
$params array Additional route parameters null
返回值
  • string

HttpIO::url( $params = null, $protocol = null)

Create a URL from the current request. This is a shortcut for:

echo URL::site($this->request->uri($params), $protocol);

参数列表

参数 类型 描述 默认值
$params string Route name null
$protocol array URI parameters null
返回值
  • string

HttpIO::csrf_check( )

CSRF 检测

同一个主域名下的请求将返回 true 否则返回 false

返回值
  • boolean

HttpIO::set_params_controller( $controller )

根据控制器设置参数

参数列表

参数 类型 描述 默认值
$controller Controller $controller

HttpIO::get_primary_domain( $host )

获取一个域名的主域名

支持传入URL

 HttpIO::get_primary_domain('test.myqee.com');              //myqee.com

 HttpIO::get_primary_domain('http://v3.myqee.com/docs/');   //myqee.com

参数列表

参数 类型 描述 默认值
$host string $host
返回值
  • string