php - Escape Spaces in this script? -


i'm using php create config file make executable , works fine when file name doesn't have spaces when file have spaces doesn't work.

the file name inside $readyfile variable.

what can fix ?

$content = ";!@install@!utf-8! title=\"auto-extract\" executefile=\"runner.exe\" executeparameters=\"--exe 2999.exe --file $readyfile\" ;!@installend@!"; $fp = fopen("config.txt","wb"); fwrite($fp,$content); fclose($fp); 

thanks

you can strip using regex.

$content=preg_replace('/\s+/', '', $content); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -