How to write the exec command(in PHP) output to a file? -



How to write the exec command(in PHP) output to a file? -

i provide illustration want directory list written file did this

<?php $command="dir"; exec($command,$output); //i want directory list written file // did $fp=fopen("file.txt","w"); fwrite($fp, $output); //its writing 0(return value exec int) file // want list of directories written file ?>

its writing 0(return value exec int) file want list of directories written file please tell me way that

you can utilize shell_exec:

<?php $output = shell_exec('dir'); $fp=fopen("file.txt","w"); fwrite($fp, $output); ?>

php

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -