开发者

PHP read, stored php var in text file

I'm trying to figure out how 开发者_如何学Goto stored php values in a string/file. I have a text file with "var1=foo&var2=foo2" etc in it, is there a way to read the values?


You could use file_get_contents() to open the file and parse_url() to parse the contents into an associative array.

$file = file_get_contents('file.txt');

parse_str($file, $params);

CodePad.


Or if you can change it, theres always serialize() and unserialize()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜