所有由zhufenghua发布的文章

PHP session能存储多大数据

php session占用程序内存,也就是 php.ini 中的 memory_limit 选项相关。

  • PHP 5.2 之前为 8M
  • PHP 5.2 为 16M
  • PHP 5.2 之后的版本为 128M

在程序处理时,比如动态生成的数组、对象等都占用 memory_limit 的数值,而 session 和它们共享,相当于程序内存数据,并没有额外存储。

除了查看配置文件之外,还可以循环往 session 里塞数据,即可测试得出当前版本当前配置下的最大数据。

kibanna 重新配置token访问令牌

linux下的命令:

bin/elasticsearch-create-enrollment-token -s kibana

windows下的命令:

bin\elasticsearch-create-enrollment-token.bat --scope kibana

参数:

-E :Configures a standard Elasticsearch or X-Pack setting.

-f, –force :Forces the command to run against an unhealthy cluster.

-h, –help :Returns all of the command parameters.

-s, –scope :Specifies the scope of the generated token. Supported values are node and kibana.

–url :Specifies the base URL (hostname and port of the local node) that the tool uses to submit API requests to Elasticsearch. The default value is determined from the settings in your elasticsearch.yml file. If xpack.security.http.ssl.enabled is set to true, you must specify an HTTPS URL.

参考 es 官方文档:elasticsearch-create-enrollment-token | Elasticsearch Guide [8.3] | Elastic

php array_column函数

从2维数组中,取一列,并封装为 一维数组

<?php
// 表示由数据库返回的可能记录集的数组
$a = array(
  array(
    'id' => 5698,
    'first_name' => 'Bill',
    'last_name' => 'Gates',
  ),
  array(
    'id' => 4767,
    'first_name' => 'Steve',
    'last_name' => 'Jobs',
  ),
  array(
    'id' => 3809,
    'first_name' => 'Mark',
    'last_name' => 'Zuckerberg',
  )
);

$last_names = array_column($a, 'last_name');
print_r($last_names);
?>

将得到:

Array
(
  [0] => Gates
  [1] => Jobs
  [2] => Zuckerberg
)
参数描述
array必需。规定要使用的多维数组(记录集)。
column_key必需。需要返回值的列。可以是索引数组的列的整数索引,或者是关联数组的列的字符串键值。该参数也可以是 NULL,此时将返回整个数组(配合 index_key 参数来重置数组键的时候,非常有用)。
index_key可选。用作返回数组的索引/键的列。