OiO.lk Blog PHP php – Escape php variables in exec()
PHP

php – Escape php variables in exec()


I wish I could use rename() function in php; but I get "ERROR: Cross-device link" when trying to move a file/directory across mounted file systems.

So I rewrote code using system( "mv -i '$from' '$to'", $res);

This works fine when $from contains spaces; but when $from contains single quote; I get sh: no closing quote.

How best to resolve this issue? I reviewed the "similar questions" but they all relate to SQL.



You need to sign in to view this answers

Exit mobile version