request.php
Table of Contents
Functions
- get_xss_clean_ins() : mixed
- 添加xss过滤
- xss_clean_str() : mixed
- 防止xss
- xss_clean() : mixed
- 防止xss
- global_trim() : mixed
- global_trim_inner() : mixed
- get() : mixed
- 取GET
- post() : mixed
- 取POST
- get_post() : mixed
- 取POST值
- g() : mixed
- get_input() : mixed
- 取php://input值
- get_full_url() : mixed
- 取当前URL完整地址
- guzzle_http() : mixed
- CURL请求
- guzzle_http_fake_option() : mixed
Functions
get_xss_clean_ins()
添加xss过滤
get_xss_clean_ins() : mixed
xss_clean_str()
防止xss
xss_clean_str(mixed $str) : mixed
Parameters
- $str : mixed
xss_clean()
防止xss
xss_clean(mixed $input) : mixed
Parameters
- $input : mixed
global_trim()
global_trim() : mixed
global_trim_inner()
global_trim_inner(mixed &$in) : mixed
Parameters
- $in : mixed
get()
取GET
get([mixed $key = "" ]) : mixed
Parameters
- $key : mixed = ""
post()
取POST
post([mixed $key = "" ]) : mixed
Parameters
- $key : mixed = ""
get_post()
取POST值
get_post([mixed $key = "" ]) : mixed
Parameters
- $key : mixed = ""
g()
g([mixed $key = null ]) : mixed
Parameters
- $key : mixed = null
get_input()
取php://input值
get_input() : mixed
get_full_url()
取当前URL完整地址
get_full_url([mixed $with_http = false ]) : mixed
Parameters
- $with_http : mixed = false
guzzle_http()
CURL请求
guzzle_http([mixed $click_option = [] ]) : mixed
GET $client = guzzle_http(); $res = $client->request('GET', $url); return (string)$res->getBody();
PUT $body = file_get_contents($local_file); $request = new \GuzzleHttp\Psr7\Request('PUT', $upload_url, $headers=[], $body); $response = $client->send($request, ['timeout' => 30]); if($response->getStatusCode() == 200){ return true; }
POST $res = $client->request('POST', $url,['body'=>]);
return (string)$res->getBody();
JSON
$res = $client->request('POST', '/json.php', [ 'json' => ['foo' => 'bar'] ]);
发送application/x-www-form-urlencoded POST请求需要你传入form_params
$res = $client->request('POST', $url, [ 'form_params' => [ 'field_name' => 'abc', 'other_field' => '123', 'nested_field' => [ 'nested' => 'hello' ] ] ]);
Parameters
- $click_option : mixed = []
guzzle_http_fake_option()
guzzle_http_fake_option() : mixed