PHP二维数组排列组合
1 | function combination(array $options) |
潘逸安
1 | function combination(array $options) |
1 | $jar = new \GuzzleHttp\Cookie\CookieJar(); |
Get the most out of Sequel Pro by remembering the following keyboard shortcuts. 通过记住以下键盘快捷键来最有效地使用Sequel Pro。
Table Structure 表结构
⌘ 1
Table Content 表内容
⌘ 2
Table Relations 表关系
⌘ 3
Table Info 表信息
⌘ 4
Custom Query 自定义查询
⌘ 5
Table Triggers 表触发器
⌘ 6
New Window (Connection File) 新窗口(连接文件)
⌘ N
New Tab(Connection File) 新标签(连接文件)
⌘ T
Add Connection To Favorites 添加连接到收藏夹
⇧ ⌘ A
Open (Connection File or SQL File) 打开(连接文件或者SQL文件)
⌘ O
Open current Connection File in New Window在新窗口打开当前连接
⌥ ⌘ O
Save (Connection File)保存(连接文件)
⌘ S
Save As (Connection File) 另存为(连接文件)
⇧ ⌘ S
Save Query保存查询
^ ⌘ S
Close (Connection File)关闭(连接)
⌘ W
Close All (Connection File) 关闭所有(连接)
⌥ ⌘ W
Print打印
⌘ P
Import 导入
⇧ ⌘ I
Show Console Window 显示控制台
⇧ ⌘ K
Clear Console 清空控制台
⌘ K
Back in History 后退
⌃ ⌥ ←
Forward in History 向前
⌃ ⌥ →
Select Next Tab 选择下一个标签
⌃ ⇥
Select Previous Tab 选择上一个标签
⌃ ⇧ ⇥
Insert NULL value 插入NULL
⌃ ⇧ N
Copy Create Table Syntax 复制创建表语法
⇧ ⌘ C
Show Create Table Syntax 显示创建表语法
⌥ ⌘ S
Refresh Databases 刷新数据库
⇧ ⌘ R
Choose Database 选择数据库
⇧ ⌘ D
Show Server Variables 显示服务器变量
⇧ ⌘ V
Show Server Processes 显示服务器进程
⌥ ⌘ P
Refresh Tables 刷新数据表
⌃ ⌘ R
Flush Privileges 刷新权限
⇧ ⌘ F
User Accounts… 用户账号
⌘ U
Copy selection / Copy selected row(s) 复制选择/复制选中的行
⌘ C
Copy selected row(s) with column names 复制选中的行包括列名
⌥ ⌘ C
Copy selected row(s) as SQL INSERT 复制选中的行包括插入语句
⌃ ⌥ ⌘ C
Show/Hide Toolbar 显示/隐藏工具栏
⇧ ⌘ T
Filter Table Content 过滤表内容
⌃ ⌘ F
Filter Tables 过滤表
⌃ ⌥ ⌘ F
Bundle Editor 构建编辑器
⌃ ⌥ ⌘ B
Navigator 导航
⌃ ⌥ ⌘ N
Select current word 选择当前单词
⌃ W
Select current line 选择当前行
⌃ L
Select enclosing brackets 选择括号内
⇧ ⌘ B
Select all 选择所有
⌘ A
Add a new field 新增字段
⌥ ⌘ A
Delete selected field 删除所选字段
⌫
Duplicate selected field 选中字段的副本
⌘ D
Refresh table structure 刷新表结构
⌘ R
Edit table details 编辑表详情
⌘ 4
Add a new row 新增行
⌥ ⌘ A
Delete selected row(s) 删除选中行
⌫
Duplicate selected row 选中行的副本
⌘ D
Refresh table contents 刷新表内容
⌘ R
Version 1.0 and later 1.0版本以后
Run all queries 运行所有查询
⌥ ⌘ R
Run current query or selection 运行当前或者选中查询
⌅ or ⌘ R
Versions 0.9.9.1 and earlier 1.0版本以前
Run all queries 运行所有查询
⌅ or ⌘ R
Run current query or selection 运行当前或者选中查询
⌥ ⌘ R
Shift line or selection rightwards 左缩进
⌘ [
Shift line or selection leftwards 右缩进
⌘ ]
(Un)Comment line or selection 注释选中行
⌘ /
(Un)Comment current query 注释当前查询
⌥ ⌘ /
Completion (narrow-down list / fuzzy search) 完成(模糊查询)
⎋
Insertion of an item 插入项目
↩ , ⇥ , Double-Click
Insertion full schema reference
⇧ + ↩ , ⇧ ⇥ , ⇧ Double-Click
Keep Window Open after Insertion 保存窗口打开后插入
holding down ⌃while insertion
Fuzzy Search 模糊查询
⌃ ⎋
Close Window 关闭窗口
⎋
Spell Checker Completion (narrow-down list) 拼写检查
F5
Select current query 选择当前查询
⌃ Y
Show MySQL help for current word or selection 显示当前单词或者选择的mysql帮助
⌃ H
Open query favorites popup menu 打开查询收藏夹弹窗
⌥ ⌘ F
Open query history popup menu 打开查询纪录弹窗
⌥ ⌘ Y
Insert previous history item (successively) 插入上一个语句(连续的)
⌃ + ↑
Insert next history item (successively) 插入下一个语句(连续的)
⌃ ↓
Show all database names as completion list 显示所有数据库名到补齐列表
⌥ ⌘ 1
Show all table and view names as completion list 显示所有表名到补齐列表
⌥ ⌘ 2
Show all table names from current database as completion list 显示当前数据库的所有表名到补齐列表
⌥ ⌘ 3
array_add($array, $field, $value) 不覆盖|不改变原数组如果给定的键不在数组中,那么 array_add 函数将会把给定的键/值对添加到数组中:
1 | $array = array_add(['name' => 'Desk'], 'price', 100); |
array_prepend($array, $value, $key =null) 可覆盖|不改变原数组array_prepend 函数将一个项目推到数组的开头:
1 | $array = ['one', 'two', 'three', 'four']; |
你可以指定用于该值的键:
1 | $array = ['price' => 100]; |
array_set($array, 'first.second', $value) 覆盖|改变原数组|返回当前深度数组array_set 函数使用「点」符号在深度嵌套的数组中设置一个值:
1 | $array = ['products' => ['desk' => ['price' => 100]]]; |
data_fill($target, 'frist.second', $value) 不覆盖|改变原结构|返回targetdata_fill 函数使用「点」符号在嵌套数组或对象内设置缺少的值:
1 | $data = ['products' => ['desk' => ['price' => 100]]]; |
该函数也接受星号「 * 」作为通配符,并相应地填写目标:
1 | $data = [ |
data_set($target, 'first.second') 嵌套设置|覆盖|改变原结构|返回$targetdata_set 函数使用「点」符号在嵌套数组或对象内设置一个值:
1 | $data = ['products' => ['desk' => ['price' => 100]]]; |
这个函数也接受通配符「 * 」,并相应地在目标上设置值:
1 | $data = [ |
默认情况下,所有现有的值都会被覆盖。如果你只想设置一个不存在值,你可以传递 false 作为第三个参数:
1 | $data = ['products' => ['desk' => ['price' => 100]]]; |
array_except($array, array $except) 排除键/键值对|不改变原数组|返回新数组array_except 函数从数组中删除给定的键/值对:
1 | $array = ['name' => 'Desk', 'price' => 100]; |
array_forget($array, 'first.second') 多维数组中移除键/值对|改变原数组|返回nullarray_forget 函数使用「点」符号从深度嵌套数组中移除给定的键/值对:
1 | $array = ['products' => ['desk' => ['price' => 100]]]; |
array_pull($array, 'key') 删除数组键值对,返回值,改变数组array_pull 函数返回并从数组中删除键/值对:
1 | $array = ['name' => 'Desk', 'price' => 100]; |
将默认值作为第三个参数传递给该方法。如果键不存在,则返回该值:
1 | $value = array_pull($array, $key, $default); |
array_first($array, $callback, $default) 返回第一个array_first 函数返回数组中第一个通过指定测试的元素:
1 | $array = [100, 200, 300]; |
将默认值作为第三个参数传递给该方法。如果没有值通过测试,则返回该值:
1 | $first = array_first($array, $callback, $default); |
array_get($array, 'first.second') 多维数组中获取值array_get 函数使用「点」符号从深度嵌套的数组中检索值:
1 | $array = ['products' => ['desk' => ['price' => 100]]]; |
array_get 函数也接受一个默认值,如果没有找到指定的健,则返回该值:
1 | $discount = array_get($array, 'products.desk.discount', 0); |
array_has($array, 'first.second'|$array) 多维数组中判断存在值array_has 函数使用「点」符号检查数组中是否存在给定的项目或项目组:
1 | $array = ['product' => ['name' => 'Desk', 'price' => 100]]; |
array_last($array, $callback, $default)最后一个array_last 函数返回数组中最后一个通过指定测试的元素:
1 | $array = [100, 200, 300, 110]; |
将默认值作为第三个参数传递给该方法。如果没有值通过测试,则返回该值:
1 | $last = array_last($array, $callback, $default); |
array_only($array, $fields) 仅返回给定数组中指定的键/值对array_only 函数仅返回给定数组中指定的键/值对:
1 | $array = ['name' => 'Desk', 'price' => 100, 'orders' => 10]; |
array_pluck($array, 'developer.name') 数组中返回检索给定键的值array_pluck 函数从数组中检索给定键的所有值:
1 | $array = [ |
你也可以指定生成的列表的键:
1 | $names = array_pluck($array, 'developer.name', 'developer.id'); |
array_random($array, $limit = 1) 返回随机值array_random 函数从数组中返回一个随机值:
1 | $array = [1, 2, 3, 4, 5]; |
你也可以指定要返回的随机数的数量作为第二个可选参数。一旦你指定了第二个参数,即使数量为 1,这个函数也会返回一个数组:
1 | $items = array_random($array, 2); |
data_get($target, 'first.second') 嵌套获取值data_get 函数使用「点」符号从嵌套数组或对象中检索值:
1 | $data = ['products' => ['desk' => ['price' => 100]]]; |
data_get 函数还接受默认值作为第三个参数,如果找不到指定的键,将返回该值:
1 | $discount = data_get($data, 'products.desk.discount', 0); |
head($array) 第一个(不过滤)head 函数返回给定数组中的第一个元素:
1 | $array = [100, 200, 300]; |
last($array) 最后一个(不过滤)last 函数返回给定数组中的最后一个元素:
1 | $array = [100, 200, 300]; |
array_collapse(...$arrays) 合并数组array_collapse 函数将多个单数组合并成一个数组:
1 | $array = array_collapse([[1, 2, 3], [4, 5, 6], [7, 8, 9]]); |
array_divide($array) 分割数组为 键值 两个数组array_divide 函数返回两个数组,一个包含原始数组的健,另一个包含原始数组的值:
1 | [$keys, $values] = array_divide(['name' => 'Desk']); |
array_dot($array) 平铺多维数组为关联数组,「点」连接array_dot 函数将多维数组平铺到一维数组中,该数组使用「点」符号表示深度:
1 | $array = ['products' => ['desk' => ['price' => 100]]]; |
array_flatten($array) 平铺多维数组为索引数组array_flatten 函数将多维数组平铺为一维数组。
1 | $array = ['name' => 'Joe', 'languages' => ['PHP', 'Ruby']]; |
array_sort($array, $callback) 排序array_sort 函数按照其值排序数组:
1 | $array = ['Desk', 'Table', 'Chair']; |
你也可以按给定的闭包返回的结果对数组进行排序:
1 | $array = [ |
array_sort_recursive($array, $callback) 递归排序array_sort_recursive 函数使用 sort 函数递归排序数组:
1 | $array = [ |
array_where($array, $callback) 过滤数组array_where 函数使用给定的闭包来过滤数组:
1 | $array = [100, '200', 300, '400', 500]; |
array_wrap() 创建数组array_wrap 函数将给定的值包装成一个数组。如果给定的值已经是一个数组,则不会被改变:
1 | $string = 'Laravel'; |
如果给定的值是空,则返回一个空数组:
1 | $nothing = null; |
使用yum在线安装ruby,安装的版本为2.0.0。
1 | yum install ruby |
1 | ruby -v |
添加aliyun镜像并检测Ruby版本
1 | gem sources -a http://mirrors.aliyun.com/rubygems/ |
RAM(Ruby Version Manager )是一款RAM的命令行工具,可以使用RAM轻松安装,管理Ruby版本。RVM包含了Ruby的版本管理和Gem库管理(gemset)
可以使用如下命令进行安装RAM:
1 | gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB |
{: .no-resize.center}
1 | curl -sSL https://get.rvm.io | bash -s stable |
出现如下信息代表安装成功:
更新配置文件,使其立马生效:
1 | source /etc/profile.d/rvm.sh |
查看RVM版本信息,如果可以代表安装成功。
1 | rvm -v |
接下来查看Ruby版本:
1 | $rvm list known |
安装Ruby,从上面查到的信息随便找一个比2.2.2版本要高的就行:
1 | rvm install 2.5 |
出现如下信息,代表安装成功:
验证版本:
成功升级。
注意:
如果使用rvm安装发现下载缓慢,可以考虑删除原来的仓库地址,只保留阿里云镜像。
1 | gem sources --remove https://rubygems.org/ |