[pmwiki-users] Setting and Using Properties
Joachim Durchholz
jo at durchholz.org
Wed Mar 1 16:58:57 CST 2006
The Editor schrieb:
>
> I'm trying to write a php script which saves the user supplied data
> from some form into a flat-file as a series of field=value pairs,
> named someauthid.txt.
Try this approach:
1) Place everything that needs to be stored in a file in an array.
2) serialize() the array into a string and write it to disk. The string
is simple ASCII and can be modified with a text editor if really needed
(it's not very nice since everything is in a single line, but manageable).
3) To get the data back into PHP, read the file and unserialize() it.
This takes care of all quoting, formatting and parsing needs for you.
Sorry for answering to the question you specifically did not ask, but if
you're new to PHP, this should still help you avoid some common pitfalls ;-)
Regards,
Jo
More information about the pmwiki-users
mailing list