Escaping spaces in variable while passing as a command line argument in php -
i have php file abc.php, processing command line arguments , @ end calling php def.php,
system("php /user/release/scheduler_test/def.php $name $final > ~/scheduler_test/logs/logs_$name.txt 2>&1 &")
the problem here is, variable $final having huge string separated spaces , since php space delimiter, not taking entire $final 1 argument.
i want pass value inside $final variable single value. can tell me how? hope clear.
that why escapeshellarg
for. escaping looking for.
a clearcut example php docs..
<?php system('ls '.escapeshellarg($dir)); ?>
so escape parameters/user-provided parameters using function wrapping around it.
Comments
Post a Comment