0
I am using a structured PHP project
index php.
<?php
require 'vendor/autoload.php';
$dotenv = new Dotenv\Dotenv( "C:/env" );
$dotenv->load();
define('VARIAVEL', getenv( 'NOME_DA_VARIAVEL' ));
echo VARIAVEL."<br>";
echo "<a href='1.php'>a</a> ";
?>
1.php
<?php
echo VARIAVEL;
?>
I would like the constant variable defined in the index to be used for the whole project
It will only 'add' it to other files via
include/require
– rray
In object oriented I did not need to give the include or require
– adventistaam
Related: What is the difference between define and const?
– rray