PHP code example of sdpmlab / codeigniter4-roadrunner
1. Go to this page and download the library: Download sdpmlab/codeigniter4-roadrunner library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sdpmlab / codeigniter4-roadrunner example snippets
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
class Home extends BaseController
{
use ResponseTrait;
public function index()
{
// Don't use:
// echo view('welcome_message');
return view('welcome_message');
}
/**
* send header
*/
public function sendHeader()
{
$this->response->setHeader("X-Set-Auth-Token", uniqid());
return $this->respond(["status"=>true]);
}
}