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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.