Hello,
I can’t seem to make it create two files.
Script file: test.php
[php]<?php
define("SRV_RT",realpath(dirname(__FILE__).'/..'));
if ($argv =0 ){
$data = SRV_RT."/create_file1.txt";
}
else{
$data = SRV_RT."/create_file2.txt";
}
$handle = fopen($data, "w+") or die("can't open file");
fwrite($handle, 'WORK DAMMIT!');
fclose($handle);
?>[/php]
What it suppose to do is if I just run the script it suppose to make create_file1.txt and if I pass any arguments it suppose to create create_file2.txt. The problem is when I try to run $argv[0] and $argv[1] it only makes create_file2.txt
cli commends:
php test.php --> creates create_file2.txt
php test.php arg1 --> creates create_file2.txt
What to do?