...

View Full Version : Reading Contents



jream
07-30-2007, 11:31 PM
Read Content

<?php
if($content = file-get-contents('verses.txt')) {
$content = str-replace('--NEXT--', '', $content);
echo $content;
}
?>

verses.txt

<span class="verses shift">
<strong>Quote:</strong>
What you do, may stun you but not God. With perfect knowledge of your imperfect life, God signed on. - Max Lucado</span>

--NEXT--

<span class="verses shift">
<strong>Quote:</strong>
A little rain can straighten a flowers stem.. A little love can change a life. - Max Lucado</span>

--NEXT--

etc..

Fatal error: Call to undefined function contents() in D:\Lostseed\helping-hand\bible-verses.php on line 36

jream
07-30-2007, 11:31 PM
oops. ha, silly me I fixed it and got to used to naming files with a dash :P

file-get-contents = file_get_contents
str-replace = str_replace

What a dumb mistake :P

rafiki
07-31-2007, 12:32 AM
for reference on a function visit http://www.php.net/function.functionname.php
like
http://www.php.net/function.file-get-contents.php
in the url you can replace _ with - and get the same results :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum