toltmanns Posted November 5, 2008 Share Posted November 5, 2008 Hey freaks :-) I'm having an issue where I am trying to load an external file (containing php code that needs to be executed) into the main php file. I have tried using file_get_contents as well as include and possibly other functions, but the php code in the external file doesn't get parsed. I've searched around looking for different code samples but I haven't found one that works right just yet. Any ideas? Thanks Troy R Oltmanns Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/ Share on other sites More sharing options...
947740 Posted November 5, 2008 Share Posted November 5, 2008 Use: include("php_file.php"); Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/#findComment-682901 Share on other sites More sharing options...
Adam Posted November 5, 2008 Share Posted November 5, 2008 Also remember you still need PHP tags around the code within your external file... Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/#findComment-682931 Share on other sites More sharing options...
Yesideez Posted November 5, 2008 Share Posted November 5, 2008 eg. <?php include("file.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/#findComment-682933 Share on other sites More sharing options...
Adam Posted November 5, 2008 Share Posted November 5, 2008 Well technically it's a statement and should be written: include 'your_file.php'; Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/#findComment-682938 Share on other sites More sharing options...
947740 Posted November 5, 2008 Share Posted November 5, 2008 I have never seen it done like that (not that that means anything), and technically, <?php include("file.php"); ?> works just fine. Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/#findComment-683008 Share on other sites More sharing options...
xcoderx Posted November 6, 2008 Share Posted November 6, 2008 its always like this <?php include "file.php"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/#findComment-683449 Share on other sites More sharing options...
kenrbnsn Posted November 6, 2008 Share Posted November 6, 2008 Directly from the manual Because include() is a special language construct, parentheses are not needed around its argument. But, it's not an error to use them. Ken Quote Link to comment https://forums.phpfreaks.com/topic/131493-php-includes-issue/#findComment-683598 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.