Help migration 3x to 4x |
Hello, I am updating the version of Codeigniter, I am facing some problems. I have a folder called Template and inside it I have some code, when calling these templates, they generate an error and so far I have not been able to solve, below is my code.
PHP Code: <?php My ControllerBase: PHP Code: <?php please help-me, and sorry my bad english Good day Guys
My ControllerBase:
<?php namespace App\Controllers; use CodeIgniter\Controller; use App\Libraries\My_parser; use App\Libraries\Preferencia; use App\Models\index_model; use App\Libraries\Traducao; use App\Libraries\Menus; class BaseController extends Controller { protected $helpers = []; public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger) { // Do Not Edit This Line parent::initController($request, $response, $logger); $this->_db = \Config\Database::connect(); $this->My_parser = new My_Parser(); $this->preferencia = new Preferencia(); $this->_model = new \App\Models\index_model(); $this->traducao = new Traducao(); $this->menus = new \App\Libraries\Menus(); //$this->$session = \Config\Services:ession($config); } public function output($data, $status){ $this->output ->set_status_header(200) ->set_content_type('application/json', 'utf-8') ->set_output( json_encode( array( 'status'=> $status, 'response'=> $data ), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES ) )->_display(); exit; } } class Usuario extends BaseController{ public $usuario = array(); public function __construct(){ parent::__construct(); // verifica se existe sessão if(!$this->session->has_userdata('id')){ $this->session->sess_destroy(); redirect("app-admin/logout"); } } public function getUsuario(){ return $this->usuario; } } My Erro: please help-me, and sorry my bad english Good day Guys
You are going to have to re-write the libraries and also there in no output library in CodeIgniter 4.
For setting headers etc. read the CodeIgniter 4 User Guide. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(10-07-2020, 01:44 PM)InsiteFX Wrote: You are going to have to re-write the libraries and also there in no output library in CodeIgniter 4. Could you help me update this class? there would use model. PHP Code: <?php my set function, I think I managed to update I have a problem with the seo and get function. could you tell me if this method is right? PHP Code: public function set(){
This is not tested! You really should sit down and read the CodeIgniter User Guide.
PHP Code: <?php What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |