Reputation: 18295
<?php
$file = fopen("configuration.conf","w+");
$settings['LogEnabled'] = "true";
$settings['Pass'] = "pass";
$settings['ShowWarning'] = "true";
fwrite($file,serialize($settings));
$path = "configuration.conf";
$file2 = file_get_contents($path);
$settings2=unserialize($file2);
echo($settings2['LogsEnabled']);
?>
It ought to show "true" when run. Whats wrong?
I tried fread and fopen for $file2, but neither work.
EDIT: It does not throw an error.
The file has permissions 0740
Upvotes: 1
Views: 78
Reputation: 767
Not sure if it matters, but you have 'LogEnabled' in the serialize section and 'LogsEnabled' in the unserialize section.
Could that 's' be throwing you off?
Upvotes: 4