You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\HTTP\Request;
use CodeIgniter\HTTP\RequestInterface;
use Services\WxConfig;
class Message extends BaseController
{
// use ResponseTrait;
public function __construct()
{
$user_email = $this->request->getPost('user_email');
$user_phone = $this->request->getPost('user_phone');
}
}
I just use this and run my code, then got the error report:
Call to a member function getPost() on null
according to the guide, I extend the BaseController ( I saw that BaseController extend Controller)
I try to add parent::__construct();, but didn't work, I saw the code in BaseController, So did I must run parent::initController(....); ? If it is like this, it means I must code these in every controller, and fill in \CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger ?
The text was updated successfully, but these errors were encountered:
Version: 4.0.2
I just use this and run my code, then got the error report:
Call to a member function getPost() on null
according to the guide, I extend the BaseController ( I saw that BaseController extend Controller)
I try to add
parent::__construct();
, but didn't work, I saw the code in BaseController, So did I must runparent::initController(....);
? If it is like this, it means I must code these in every controller, and fill in\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger
?The text was updated successfully, but these errors were encountered: