消息:CI_Session_files_driver::open($save_path, $name) 的返回类型应与 SessionHandlerInterface 兼容:

问题描述 投票:0回答:2

我无法找到代码点火器中遇到的此错误的解决方案。我已经尝试了所有可用的解决方案,例如 drivers/Session_files_driver.php ,这些解决方案适用于此页面。

这是我在登录登录页面时遇到的错误。消息:CI_Session_files_driver::open($save_path, $name) 的返回类型应该与 SessionHandlerInterface::open(string $path, string $name) 兼容: bool,或者应该使用 #[\ReturnTypeWillChange] 属性来暂时抑制通知

文件名:drivers/Session_files_driver.php

线路号码:132

消息:CI_Session_files_driver::close() 的返回类型应与 SessionHandlerInterface::close(): bool 兼容,或者应使用 #[\ReturnTypeWillChange] 属性暂时抑制通知 文件名:drivers/Session_files_driver.php 我已经尝试过这个解决方案解决方案

我已经尝试过这个解决方案解决方案 控制器登录.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Login extends CI_Controller {
       public function __construct()
      {
        parent::__construct();
        // $this->load->model('Login_Model');
        $this->load->library('form_validation');
        // $this->load->library('session');
        $this->load->helper('form');
        $this->load->database();

      }
      public function index() { die("22");
$this->load->view('login');
}

// Validate and store registration data in database
 public function validate() { die("22");
  $this->load->helper('url');
if($this->input->post('username'))
{
  $this->db->where('username',$this->input->post('username'));
   $this->db->where('password', md5($this->input->post('password')));
   $rows=$this->db->get('login');
    if($rows->num_rows()==1)
    {
      $data = array('username'=>$this->input->post('username'),'is_logged_in'=>TRUE);
      $this->session->set_userdata('ci_session',$data);

      redirect('Motherindia/index');
          }
      }
      else{
        echo "<script>alert('Your password and username is wrong!Try again...!333');</script>";

    }
     $this->index();
  }
  public function logout()
  {
    $this->session->unset_userdata('ci_session');
     $this->load->view('login');
  }
}
php codeigniter-3
2个回答
0
投票

我得到了我错过的这个问题的解决方案

$config['base_url'] = 'http://localhost/miirps';
,其中
http://
在我的config.php文件中


0
投票

#[AllowDynamicProperties]是在类之前添加

示例: #[允许动态属性] CI_Loader 类 {

#[\ReturnTypeWillChange] 是在函数之前添加

示例: #[\ReturnTypeWillChange] 函数我的函数{

这是 PHP 8.2 中的解决问题

© www.soinside.com 2019 - 2024. All rights reserved.