HOME       >>       Programming

Php Cli Input File


FirefoxRocks

I have wrote a PHP program for the command line. Currently it is using STDIN for input, but in this case I need it to read from a file. How do I pass the file onto the program in an argument if I'm using the command line?Currently I execute my programs using:php -f ./myprogram.php


yordan

did you try this way :php -f ./myprogram.php <myfile.txtwhere "myfile.txt" has each item you entered (one line per input).



VIEW ORIGINAL REGISTER GET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.