NCS_One Posted October 13, 2009 at 01:29 AM Report Share #291461 Posted October 13, 2009 at 01:29 AM Boas. Consigo definir variáveis num ficheiro com : extract( $arrayVariaveis ); ob_start(); include( "file.php); $contents = ob_get_contents(); ob_end_clean(); Consigo extrair o conteúdo ( HTML ) de uma função : ob_start(); myFunc(); $contents = ob_get_contents(); ob_end_clean(); Mas não sei é como definir as variáveis na função, algumas ideias ? Obrigado. Se a vida te voltar as costas aproveita e apalpa-lhe o cu. Link to comment Share on other sites More sharing options...
yoda Posted October 13, 2009 at 02:30 AM Report Share #291464 Posted October 13, 2009 at 02:30 AM Tens de ser mais esplícito before you post, what have you tried? - http://filipematias.info sense, purpose, direction Link to comment Share on other sites More sharing options...
NCS_One Posted October 13, 2009 at 02:47 AM Author Report Share #291465 Posted October 13, 2009 at 02:47 AM file1.php <div><?php echo $myVar;?></div> file2.php $arrayVariaveis[ 'myVar' ] = 'Isto é o file1.php'; extract( $arrayVariaveis ); ob_start(); include( "file1.php); $contents = ob_get_contents(); ob_end_clean(); Quando correr o file2.php a variável $contents vai ficar assim '<div>Isto é o file1.php</div> Agora imagine-mos que o file1.php está assim : <?php function myFunc() { ?> <div><?php echo $myVar;?></div> <?php } ?> Há alguma forma de fazer o que o anterior fez ? Se a vida te voltar as costas aproveita e apalpa-lhe o cu. Link to comment Share on other sites More sharing options...
scorch Posted October 13, 2009 at 01:34 PM Report Share #291503 Posted October 13, 2009 at 01:34 PM <?php function myFunc() { Global $myVar; ?> <div><?php echo $myVar;?></div> <?php } ?> <?php myFunc(); ?> PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now