Page 1 of 1

Setting a variable equal to contents of a file

Posted: Fri Dec 22, 2006 5:24 am
by richmix
Hey all, I'm sorry I have to bug you guys with what is probably a very easy-to-answer question, but Google isn't being very friendly with my queries on this one. I just want to know how to set a variable equal to the contents of a particular file, like in the following (non-functional) example:

$var = include('file.php')

I'm trying to create a form mailer that uses templates.

Thanks!

Posted: Fri Dec 22, 2006 5:28 am
by Kieran Huggins
file_get_contents()

It's listed in the "filesystem" section of the manual: http://www.php.net/manual/en/ref.filesystem.php

Cheers,
Kieran

Posted: Fri Dec 22, 2006 5:30 am
by richmix
Yay! Thank you! I looked through that manual, but there are a billion and one entries in it. It's easy to miss what you're looking for.