denoteone Posted September 12, 2010 Share Posted September 12, 2010 I have been researching php.net regain the function parse_ini_file() I know you can pass it an actual ini file but what if you already saved the ini file as a string and saved the string in a variable can you pass that variable to the function? I am getting the following error [function.parse-ini-file]: failed to open stream: No such file or directory in this is how I am calling it. $settings = parse_ini_file($data); echo $settings["mac"]; Quote Link to comment Share on other sites More sharing options...
objnoob Posted September 12, 2010 Share Posted September 12, 2010 array parse_ini_string ( string $ini [, bool $process_sections = false [, int $scanner_mode = INI_SCANNER_NORMAL ]] ) Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted September 12, 2010 Share Posted September 12, 2010 If you have PHP 5.3 then use parse_ini_string(). If not, then you have to use the filename and pass it to parse_ini_file() because that's what it expects. Quote Link to comment Share on other sites More sharing options...
objnoob Posted September 12, 2010 Share Posted September 12, 2010 Then why not build a file... use parse_ini_file, and delete the file Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted September 12, 2010 Share Posted September 12, 2010 Then why not build a file... use parse_ini_file, and delete the file That's definitely a possibility. I almost posted that, but I was speaking to, in effect: "why doesn't passing a string of data to a function that expects a filename work..." Quote Link to comment Share on other sites More sharing options...
denoteone Posted September 12, 2010 Author Share Posted September 12, 2010 Then why not build a file... use parse_ini_file, and delete the file this is what I am going to have to do. The info is actually in a database but saved in an ini format. I will get the info from the DB write it to a ini file then call the ini file so I can manipulate it. I can then resave the info in a variable and put it back in the DB. I am worried about the the new lines characters. Does this sound like the best way to accomplish this process? I am open to suggestions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.