canadabeeau Posted March 14, 2010 Share Posted March 14, 2010 Hi I have a file index.php which then does require_once('content.php'); now content.php also has require_once('functions.php'); but this is NOT working, any ideas All help much appreciated Link to comment https://forums.phpfreaks.com/topic/195178-require_once-not-working/ Share on other sites More sharing options...
canadabeeau Posted March 14, 2010 Author Share Posted March 14, 2010 The error is atal error: Call to undefined function page() in content.php and page() does exists in functions.php so the require_once is not working in that tier Link to comment https://forums.phpfreaks.com/topic/195178-require_once-not-working/#findComment-1025858 Share on other sites More sharing options...
wildteen88 Posted March 14, 2010 Share Posted March 14, 2010 Make sure you're requiring functions.php before you call the page() function. If it still doesn't work then post your code here. Link to comment https://forums.phpfreaks.com/topic/195178-require_once-not-working/#findComment-1025859 Share on other sites More sharing options...
canadabeeau Posted March 14, 2010 Author Share Posted March 14, 2010 This is the index.php <?php $require_once = "http://".$_SERVER['HTTP_HOST']."/_inc/php/content.php"; require_once($require_once); ?> Content.php <?php $require_once = "http://".$_SERVER['HTTP_HOST']."/_inc/php/functions.php"; require_once($require_once); echo uri(); ?> then the functions.php <?php function uri(){ $test = "AAA"; return $test ;}?> Link to comment https://forums.phpfreaks.com/topic/195178-require_once-not-working/#findComment-1025860 Share on other sites More sharing options...
wildteen88 Posted March 14, 2010 Share Posted March 14, 2010 Dont use a url. You should be using a file path, eg require_once $_SERVER['DOCUMENT_ROOT'] . '/_inc/php/functions.php'; Link to comment https://forums.phpfreaks.com/topic/195178-require_once-not-working/#findComment-1025862 Share on other sites More sharing options...
canadabeeau Posted March 14, 2010 Author Share Posted March 14, 2010 Sorted, thanks Link to comment https://forums.phpfreaks.com/topic/195178-require_once-not-working/#findComment-1025866 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.