```
~~~
public function cookc()
{
//實例化客戶端
$client = new \GuzzleHttp\Client(['cookie'=>true]);
//構造url
$url = 'https://www.taobao.com';
//設置代理請求
$res = $client->request('GET', $url)->getBody()->getContents();
//返回狀態碼
dump($res);
}
~~~
```
```
~~~
string(111399) "
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<title>淘*網 - 淘!我喜歡</title>
<meta name="spm-id" content="a21bo" />
~~~
```
```
~~~
public function cooka()
{
// $client = new \GuzzleHttp\Client(['cookies' => true]);
$client = new \GuzzleHttp\Client(['base_uri' => 'https://www.tao*ao.com/']);
$jar = new \GuzzleHttp\Cookie\CookieJar;
$r = $client->request('GET', 'https://www.tao*ao.com/', [
'cookies' => $jar
]);
// $r = $client->request('GET', 'https://www.tao*ao.com');
dump($r);
}
~~~
```
```
~~~
object(GuzzleHttp\Psr7\Response)#67 (6) {
["reasonPhrase":"GuzzleHttp\Psr7\Response":private] => string(2) "OK"
["statusCode":"GuzzleHttp\Psr7\Response":private] => int(200)
["headers":"GuzzleHttp\Psr7\Response":private] => array(26) {
["Server"] => array(1) {
[0] => string(7) "Tengine"
}
["Content-Type"] => array(1) {
[0] => string(24) "text/html; charset=utf-8"
}
["Transfer-Encoding"] => array(1) {
[0] => string(7) "chunked"
}
["Connection"] => array(1) {
[0] => string(10) "keep-alive"
}
["Date"] => array(1) {
[0] => string(29) "Sat, 25 Sep 2021 08:22:05 GMT"
}
["Vary"] => array(2) {
[0] => string(15) "Accept-Encoding"
[1] => string(50) "Origin, Ali-Detector-Type, X-Host, Accept-Encoding"
}
["x-server-id"] => array(1) {
[0] => string(80) "28c3d6b2523ca52cb704b8b5dcd97677865cbbd91a3b0c7390a3a6f9f6babccc8bb00e660f25c2b1"
}
["x-air-hostname"] => array(1) {
[0] => string(31) "air-ual011087145003.center.na61"
}
["x-air-trace-id"] => array(1) {
[0] => string(26) "6f07ad0d16325581250005461e"
}
["Cache-Control"] => array(1) {
[0] => string(23) "max-age=0, s-maxage=109"
}
["etag"] => array(1) {
[0] => string(37) "W/"1b212-8CR+cNi3V6+Yp01zdJgFJgctuxg""
}
["x-readtime"] => array(1) {
[0] => string(3) "221"
}
["x-via"] => array(1) {
[0] => string(93) "cn474.l1, cache3.cn474, l2nu16-1.l2, cache21.l2nu16-1, wormholesource011001084075.center.na61"
}
["x-air-source"] => array(1) {
[0] => string(5) "proxy"
}
["x-xss-protection"] => array(1) {
[0] => string(13) "1; mode=block"
}
["EagleEye-TraceId"] => array(1) {
[0] => string(26) "6f07ad0d16325581250005461e"
}
["Strict-Transport-Security"] => array(1) {
[0] => string(16) "max-age=31536000"
}
["Timing-Allow-Origin"] => array(1) {
[0] => string(4) "*, *"
}
["Ali-Swift-Global-Savetime"] => array(1) {
[0] => string(10) "1632558125"
}
["Via"] => array(1) {
[0] => string(106) "cache21.l2nu16-1[294,233,304-0,C], cache14.l2nu16-1[235,0], cache16.cn697[0,0,200-0,H], cache9.cn697[20,0]"
}
["Age"] => array(1) {
[0] => string(1) "3"
}
["X-Cache"] => array(1) {
[0] => string(26) "HIT TCP_MEM_HIT dirn:-2:-2"
}
["X-Swift-SaveTime"] => array(1) {
[0] => string(29) "Sat, 25 Sep 2021 08:22:05 GMT"
}
["X-Swift-CacheTime"] => array(1) {
[0] => string(3) "109"
}
["x-air-pt"] => array(1) {
[0] => string(3) "pt0"
}
["EagleId"] => array(1) {
[0] => string(26) "3da8641d16325581283392727e"
}
}
["headerNames":"GuzzleHttp\Psr7\Response":private] => array(26) {
["server"] => string(6) "Server"
["content-type"] => string(12) "Content-Type"
["transfer-encoding"] => string(17) "Transfer-Encoding"
["connection"] => string(10) "Connection"
["date"] => string(4) "Date"
["vary"] => string(4) "Vary"
["x-server-id"] => string(11) "x-server-id"
["x-air-hostname"] => string(14) "x-air-hostname"
["x-air-trace-id"] => string(14) "x-air-trace-id"
["cache-control"] => string(13) "Cache-Control"
["etag"] => string(4) "etag"
["x-readtime"] => string(10) "x-readtime"
["x-via"] => string(5) "x-via"
["x-air-source"] => string(12) "x-air-source"
["x-xss-protection"] => string(16) "x-xss-protection"
["eagleeye-traceid"] => string(16) "EagleEye-TraceId"
["strict-transport-security"] => string(25) "Strict-Transport-Security"
["timing-allow-origin"] => string(19) "Timing-Allow-Origin"
["ali-swift-global-savetime"] => string(25) "Ali-Swift-Global-Savetime"
["via"] => string(3) "Via"
["age"] => string(3) "Age"
["x-cache"] => string(7) "X-Cache"
["x-swift-savetime"] => string(16) "X-Swift-SaveTime"
["x-swift-cachetime"] => string(17) "X-Swift-CacheTime"
["x-air-pt"] => string(8) "x-air-pt"
["eagleid"] => string(7) "EagleId"
}
["protocol":"GuzzleHttp\Psr7\Response":private] => string(3) "1.1"
["stream":"GuzzleHttp\Psr7\Response":private] => object(GuzzleHttp\Psr7\Stream)#65 (7) {
["stream":"GuzzleHttp\Psr7\Stream":private] => resource(118) of type (stream)
["size":"GuzzleHttp\Psr7\Stream":private] => NULL
["seekable":"GuzzleHttp\Psr7\Stream":private] => bool(true)
["readable":"GuzzleHttp\Psr7\Stream":private] => bool(true)
["writable":"GuzzleHttp\Psr7\Stream":private] => bool(true)
["uri":"GuzzleHttp\Psr7\Stream":private] => string(10) "php://temp"
["customMetadata":"GuzzleHttp\Psr7\Stream":private] => array(0) {
}
}
}
~~~
```
- extend加入模塊
- array_column() expects parameter 1 to be array, object given
- tp5.1安裝No input file specified.
- ROOT
- wechatDeveloper
- ThinkLibrary
- 語法錯誤: unexpected '?'
- Cannot use object of type stdClass as array
- Invalid argument supplied for foreach()
- 常量上傳
- 命名空間extend_email_Aindex
- Validate
- 'cross-env' 不是內部或外部命令,也不是可運行的程序
- 內置規則
- composer self-update
- cURL error 60: SSL certificate problem
- GuzzleHttp_Client_cookie_true
- cookies原始字符串轉換為數組
- 設置cookie
- apidoc
- 原生安裝tp5
- array_unique
- explode
- tp3修改密碼
- tp打印SQL
- tp5一對一關聯
- allowField
- array_column
- array_key_exists
- array_search
- tp5如何引入自定義函數
- with
- with閉包
- 綁定類
- composer A
- array_filter用回調函數過濾數組中的元素
- array_keys
- array_slice截取前兩個
- fetch_assoc
- in_array是否存在指定的值
- is_null
- join
- krsort對數組排序
- array-udiff
- shuffle
- substr
- unset刪除多維數組key
- 多維轉一維函數
- 數組變成字符串implode
- 數組分割
- 數組取差集
- 隨機函數array_rand
- 一維變二維
- 字符串包裹變量
- 字符串漢字截取mb_substr
- 直接使用composer命令
- 安裝vendor
- composer命令
- 復制安裝
- 空目錄安裝
- tp5cms
- tp5調試
- tp3調試
- TP5一對一關聯
- SQL語句
- 清空數據
- 去重
- 去重保留最小id
- 去重匹配除數字外數據
- 事務
- tp5pdf亂碼
- tp5column_tp3getFieldtrue
- php代碼在線測試,php在線執行
- parent::_initialize