Jump to content

using variables when creating a file


herghost

Recommended Posts

Hi all

 

I am having some issues

 

basically

 

$sftp->put("server.properties", 
"allow-nether=".$nether."
level-name=".$lname."");

 

is not printing the variables. $sftp is part of the phpseclib and the fuction is in the same format as fwrite(), I have tried and failed using fwrite as well! I can echo out the 1st variable correctly, but as soon as I add the second I just get

 

allow-nether=
level-name=

 

The variables $nether and $lname exist and I have echo'd them to check.

 

I guess this is a formatting problem, just cant work it out!

Link to comment
https://forums.phpfreaks.com/topic/255024-using-variables-when-creating-a-file/
Share on other sites

remove the put functions and display it directly, once you got your output right add put.

This looks like a continuation of the other post that retrieved values.

for that I would opt for a reverse operation of the code posted there.

 

$out='';
foreach($vars as $key=>$val)
{
    $out.="$key=$val".PHP_EOL;
}
echo $out;

if $out is what you want, then try using your ftp put function

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.