string - preserving text format php for UserData -


my problem seems simple stuck.

i have template file has content below:

#!/bin/sh      sudo -s;     touch /tmp/{{key}} 

my requirement have read file replace key value , pass userdata input aws php sdk .

how after running

$key = "{{key}}"; $value ="test1.txt"; $filecontent = file_get_contents($templatepath); str_replace("{{" . $key . "}}", "$value", $filecontent); 

to above file content format lost. generates follows

#!/bin/sh sudo -s;touch /tmp/test1.txt 

i lost format , sdk not understand bash script


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

python - TypeError('Unrecognized keyword arguments: ' + str(kwargs)) # Validate user data -