在PHP CLI使用的功能在session_start打印下一个警告: session_start(): Cannot send session cookie - headers already sent by (output started at /home/robi/p/test.php:1) in /home/robi/p/test.php on line 2
,为什么?
我想记录在一个变量中的所有客户端条目,并检查了这一点,看看我通过比较时间用户最后一个条目和电流输入的时间得到一个特定的远程地址伪造的! 我是不是做错了?
这里是我的代码:
<?php
session_start();
//$entries = array();
//$client_address = $_SERVER["REMOTE_ADDR"] . ':' . $_SERVER["REMOTE_PORT"];
//$client_entry = time();
//array_push( $entries, $client_entry );
$client_entry = time();
$_SESSION["entries"][] = $client_entry;
$entries = $_SESSION["entries"];
$check_out = array_filter(
$entries,
function($value) use($client_entry) {
return ($value >= ($client_entry + (1 * 0.6)));
}
);