thenature4u Posted April 16, 2008 Share Posted April 16, 2008 i want to read some static content from .php file. i want to read and and keep that in a variable. help me. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/101316-how-to-read-content-from-php-file/ Share on other sites More sharing options...
AP81 Posted April 16, 2008 Share Posted April 16, 2008 You don't need to use a .php file if you want to read static content. Have a look in the PHP file for fopen. Using fopen you can open the file, then use fread to read the file. Quote Link to comment https://forums.phpfreaks.com/topic/101316-how-to-read-content-from-php-file/#findComment-518232 Share on other sites More sharing options...
thenature4u Posted April 16, 2008 Author Share Posted April 16, 2008 Thanks for your reply, but i need to read the content from .php file for other purposes. if you have any idea, let me know. Quote Link to comment https://forums.phpfreaks.com/topic/101316-how-to-read-content-from-php-file/#findComment-518233 Share on other sites More sharing options...
schme16 Posted April 16, 2008 Share Posted April 16, 2008 Can you clarify a little on what you want done. did you mean that you want to read the parsed value of a php file, with php? or did you want to read the code itself from the php file? Quote Link to comment https://forums.phpfreaks.com/topic/101316-how-to-read-content-from-php-file/#findComment-518241 Share on other sites More sharing options...
thenature4u Posted April 16, 2008 Author Share Posted April 16, 2008 my code is like this <? define('ABOUT US','We are the development People'); ?> i want to read this .php file and save this content to a variable. Thanks for reply. Quote Link to comment https://forums.phpfreaks.com/topic/101316-how-to-read-content-from-php-file/#findComment-518245 Share on other sites More sharing options...
schme16 Posted April 16, 2008 Share Posted April 16, 2008 Hmm, perhaps you actually need include('path/to/file.php'); you want that variable to be carried across use the include function. Quote Link to comment https://forums.phpfreaks.com/topic/101316-how-to-read-content-from-php-file/#findComment-518269 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.