-1
I’m creating a generic file where several systems can use the same libraries, thus generating a much smaller package. In this generic file there is a function where I do the necessary file includes. The problem that is occurring, is that when I do the system includes in that function, I do not have access to the properties, variables and functions of the included file. I will try to exemplify with the system structure.
The structure of the system is:
wamp/www/sistem/exemploSistema/index.phpwamp/www/sistem/exemploSistema/funcoes.phpwamp/www/sistem/generics/funcaoGenerica.php
Filing cabinet funcoes.php:
<?
$tt = 'teste';
function teste(){
global $tt;
return $tt;
}
?>
Filing cabinet funcaoGenerica.php:
<?php
function generic($sting){
include_once($sting);
}
?>
Filing cabinet index.php:
<?
include_once('/sistem/generics/funcaoGenerica.php');
generic('/sistem/exemploSistema/funcoes.php');
echo teste();
?>
In the archive index.php I can’t access the function teste of the archive funcoes.php. Would you have some solution to that problem or some other way to it?
exchange the
include_onceby arequired_onceand see if there are any errors.– Marcos
Shows any error message? Swap
<?for<?php– Papa Charlie
no error appears, only turns me empty!
– Douglas Bernardino
It works if you put
include_once('/sistem/exemploSistema/funcoes.php');instead ofgeneric('/sistem/exemploSistema/funcoes.php');?– Marcos
You changed what I said?
– Papa Charlie