V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  HappyStraw  ›  全部回复第 1 页 / 共 1 页
回复总数  6
https://www.rfc-editor.org/rfc/rfc2616#section-5

```text
Request = Request-Line ; Section 5.1
*(( general-header ; Section 4.5
| request-header ; Section 5.3
| entity-header ) CRLF) ; Section 7.1
CRLF
[ message-body ]
```

1. HTTP 是 CRLF 换行, 不是用不用 windows 的问题.

2. 在 Archlinux curl 7.88.1 下, HEAD https://api.github.com/users/octocat, 返回为 http/2, header 为小写

```text
HTTP/2 404
server: GitHub.com
date: Tue, 28 Feb 2023 01:45:47 GMT
content-type: application/json; charset=utf-8
content-length: 84
x-github-media-type: github.v3; format=json
x-github-api-version-selected: 2022-11-28
x-ratelimit-limit: 60
x-ratelimit-remaining: 52
x-ratelimit-reset: 1677550667
x-ratelimit-used: 8
x-ratelimit-resource: core
...省略
```

3. awk 设置 IGNORECASE=1 大小写不敏感, 如:

```bash
echo "${githubGetRateInfo}"|awk 'BEGIN{IGNORECASE=1}/^X-RateLimit-Limit:/{print $2}'|tr -d '\r'
```
<img src="https://img03.sogoucdn.com/app/a/100520146/9cfd093a59065afe47b8eab70cc4f3a0" alt="18533666.jpg" title="18533666.jpg" />
1. KDE:

- 在设置 KWin Scripts 里面搜索 Sticky Window Snapping 并下载安装, 打勾启用就可以了

2. Gnome:
- 方式 1: 直接 pacman -S gnome-shell-extension-appindicator
- 方式 2: Extensions 安装扩展:AppIndicator and KStatusNotifierItem Support: https://extensions.gnome.org/extension/615/appindicator-support
2022 年 3 月 2 日
回复了 aababc 创建的主题 PHP PHP 数组转对象
我是做一个简单的参数转换:
1. 基类(如: PropertyAccess);
2. 实现 \JsonSerializable, \ArrayAccess 接口
3. 实现了魔术方法__call, 完成 getter 和 setter, 里面可以对属性名字转换, 驼峰和下划线互相转换
4. 参数选项默认 protected
5. 提供静态方法 from(array $data)从 JSON 中初始化(默认赋值, 如子参数是 PropertyAccess 子类, 在里面初始化), 也可以在__construct 实现
6. 提供 toArray(如子参数是 PropertyAccess 子类那就里面 toArray)

大致的效果
/**
* Class User
*
* @method int getId()
* @method string getName()
* @method void setId(int $id)
* @method void setName(string $name)
*/
class User extends PropertyAccess
{
protected $id;

protected $name;
}

$user = User::from(['id' => 1, 'name' => 'xiaoming']);

echo $user->getName();
echo $user->getId();
echo json_encode($user);
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1023 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 23:24 · PVG 07:24 · LAX 15:24 · JFK 18:24
♥ Do have faith in what you're doing.