0
Guys I’m having this error, I read that this message appears when an error occurs in a previous line of code, what is strange to me is what is happening in the first line of the file.
Parse error: syntax error, Unexpected '$folder' (T_VARIABLE) in
<?php
$pasta = $_SERVER["DOCUMENT_ROOT"]."/arquivos/";
if(is_dir($pasta))
{
$diretorio = dir($pasta);
while($arquivo = $diretorio->read())
{
if(($arquivo != '.') && ($arquivo != '..'))
{
unlink($pasta.$arquivo);
echo 'Arquivo '.$arquivo.' foi apagado com sucesso. <br />';
}
}
$diretorio->close();
}
else
{
echo 'A pasta não existe.';
}
?>
How you executed this file?
– Woss
Boy, I copied your code from here and made the same mistake, but when I rewrote it exactly the same, it worked
– Wees Smith
Yeah, that’s exactly what the other fellow said.
– Marcos Goulart de Oliveira