San*_*sha 30 php session codeigniter-3
安装新的 xampp 版本(php8)后出现此错误。并克隆我的 codeigniter 项目。
Message: Return type of CI_Session_files_driver::open($save_path, $name)
should either be compatible with SessionHandlerInterface::open(string $path, string $name):
bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Run Code Online (Sandbox Code Playgroud)
文件名:drivers/Session_files_driver.php
线路号码:132
b4t*_*tch 75
对于遇到此错误的其他人,我在升级到 PHP 8.1 后也遇到过此错误。我能找到“修复”它的唯一方法是在、、、和函数#[\ReturnTypeWillChange]
之前添加. 例如:open
read
write
close
destroy
gc
/system/libraries/Session/drivers/Session_files_driver.php
#[\ReturnTypeWillChange]
public function open($save_path, $name)
{
...
Run Code Online (Sandbox Code Playgroud)
小智 36
重新安装 XAMPP 服务器后,我遇到了此错误。我通过添加解决了这个问题
#[\ReturnTypeWillChange]
对于 中的所有方法( open, read, write, close, destroy and gc
) Session_files_driver.php file
该文件可以在项目文件夹中找到system/libaries/Session/drivers/Session_files_driver.php
#[\ReturnTypeWillChange]
public function open($save_path, $name)
{
...
}
#[\ReturnTypeWillChange]
public function read($session_id)
{
...
}
#[\ReturnTypeWillChange]
public function write($session_id, $session_data)
{
...
}
#[\ReturnTypeWillChange]
public function close()
{
...
}
#[\ReturnTypeWillChange]
public function destroy($session_id)
{
...
}
#[\ReturnTypeWillChange]
public function gc($maxlifetime)
{
...
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
92609 次 |
最近记录: |