I need to create a .php file with the results that appear accessing another .php file, for example:
I access link and this page results in lists of files on a page. For this I use this code:
<?php
$pasta = 'imagens/';
if(is_dir($pasta))
{
$diretorio = dir($pasta);
while(($arquivo = $diretorio->read()) !== false)
{
echo ''.$arquivo.'<br />';
}
$diretorio->close();
}
else
{
echo 'A pasta não existe.';
}
? >
I need the result "file1.ini", "file2.ini" ... to be written to an .php file. I tried changing the page code as follows:
<?php
$filename = 'meuteste.php';
$pasta = '/xampp/htdocs/';
if(is_dir($pasta))
{
$diretorio = dir($pasta);
while(($arquivo = $diretorio->read()) !== false)
{
int file_put_contents ($filename, echo ''.$arquivo.'</a><br />');
}
}
else
{
echo 'A pasta não existe.';
}
?>
But the command is wrong, I get this message when I open link :
Parse error: syntax error, unexpected 'file_put_contents' (T_STRING) in C: \ xampp \ htdocs \ lista.php on line 10
Has anyone ever had something like this? Do you know the solution?
Thanks in advance.