| | |
file_get_contens doesn`t work
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2005
Posts: 5
Reputation:
Solved Threads: 0
I`m trying to load the contents of a php file, change some variables through a replace, and save it again, but upon loading, the file_get_contents doesn`t parse the start of the file for some reason. I tried this on my server and on the local server.
Example :
filesample.php :
read_file.php
Output :
Waiting for your thoughts and experiences.
Example :
filesample.php :
php Syntax (Toggle Plain Text)
<?php $var1 = array('this' => 'that'); ?>
read_file.php
php Syntax (Toggle Plain Text)
<?php $fp = file_get_contents('filesample.php'); echo '<pre>'.$fp.'</pre>'; ?>
Output :
PHP Syntax (Toggle Plain Text)
'that'); ?>
Waiting for your thoughts and experiences.
Last edited by bin_asc; Sep 7th, 2008 at 9:06 pm.
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
•
•
•
•
did you view the source. sometimes pre tags don't work for me and i know that browsers like to hide php code.
<?php
$var1 = array('this' => 'that');
?>
<...>
Looks like a tag to a browser ... even though it doesn't know what tag it is, so doesn't parse it, it still doesn't show it either.
php Syntax (Toggle Plain Text)
<?php $fp = file_get_contents('filesample.php'); echo '<pre>'.htmlspecialchars($fp).'</pre>'; ?>
Cheers
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
![]() |
Other Threads in the PHP Forum
- Previous Thread: Dynamic HTML link with Nested PHP
- Next Thread: calling function name? i need help
Views: 908 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax alexa apache api array beginner beneath binary broadband broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion redirect regex remote script search select server sessions sms smtp soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube






