From our sponsor: Agent.ai Builder is now open—no waitlist. Explore 12+ foundation models, no-code to full-code. Free!
Here’s a simple way to execute the windows dir or the linux ls in PHP
Windows:
<?php $row = exec('dir',$output,$error); while(list(,$row) = each($output)){ echo $row, "<BR>n"; } if($error){ echo "Error : $error<BR>n"; exit; } ?>
Linux:
<?php $row = exec('ls -ls',$output,$error); while(list(,$row) = each($output)){ echo $row, "<BR>n"; } if($error){ echo "Error : $error<BR>n"; exit; } ?>
Tiny break: 📬 Want to stay up to date with frontend and trends in web design? Check out our Collective and stay in the loop.
Pingback: PHP: How to list files of a directory
Alem de executar em diretórios ele também server para executar comandos CMD, valeu pelo código obrigado!