Answer the question
In order to leave comments, you need to log in
What is the correct way to instantiate Psr\Http\Message\ResponseInterface?
Good day, having difficulty with Psr\Http\Message\ResponseInterface
there is the following code
<?php
use Slim\Views\PhpRenderer;
use Psr\Http\Message\ResponseInterface;
error_reporting(E_ALL);
ini_set('display_errors',true);
define('H', $_SERVER['DOCUMENT_ROOT'].'/');
session_start();
ob_start();
require H . 'system/vendor/autoload.php';
try {
require H .'system/common.php';
$response = new ResponseInterface();
$phpView = new PhpRenderer(H . 'app/templates/', ["title" => "My App"]);
$phpView->setLayout("layout.php");
$phpView->render($response, 'main.php', ["title" => "Hello - My App", "name" => "John"]);
} catch (Exception $e) {
die ('Error ' . $e->getMessage());
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question