Constant value throughout the project

Asked

Viewed 27 times

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

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.