How might I set a variable to the contents of a text file? I learned the following doesn't work, though by looking at it I'm sure you'll figure out what I was wanting:
$content_index = include('html/index.html');
Set a variable to the contents of a file.
Moderator: General Moderators
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
- shiznatix
- DevNet Master
- Posts: 2745
- Joined: Tue Dec 28, 2004 5:57 pm
- Location: Tallinn, Estonia
- Contact:
Code: Select all
$contents = file_get_contents("somefile.txt");-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
Hey Majorslayer, you might want to check out the PHP Manual. No joke! It's one of the best php resources out there. I use it _all_ the time. It'll give you good answers faster than you think. 
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
In case its not clear, let me explain it.Majoraslayer wrote:Yep, fish through 3 million commands when I could just as easily ask some experienced people. I see the logic
First, you don't have to fish through it. The search on php.net's manual is top-notch, even better (because it is so focused) than google in many cases.
Second, the only reason the experienced people *can* answer questions is because users take the time to try to fix the problem, look for answers online, and only when they get truly stumped ask questions. We'd literally never have time if we tried to replace the manual or google.
Not trying to be short or rude, but trust me, you won't get answers for long if you won't take those simple first steps.
-
Majoraslayer
- Forum Commoner
- Posts: 64
- Joined: Thu Jun 30, 2005 11:50 am
- Location: In Your Mind...
- Contact:
Sorry, didn't mean to offendRoja wrote:In case its not clear, let me explain it.Majoraslayer wrote:Yep, fish through 3 million commands when I could just as easily ask some experienced people. I see the logic
First, you don't have to fish through it. The search on php.net's manual is top-notch, even better (because it is so focused) than google in many cases.
Second, the only reason the experienced people *can* answer questions is because users take the time to try to fix the problem, look for answers online, and only when they get truly stumped ask questions. We'd literally never have time if we tried to replace the manual or google.
Not trying to be short or rude, but trust me, you won't get answers for long if you won't take those simple first steps.
I was just kidding, and I forgot the manual was online >_<.