slpctrl Posted March 30, 2008 Share Posted March 30, 2008 How does one go about achieving something like http://site.com/?file=links.html Quote Link to comment https://forums.phpfreaks.com/topic/98646-include-question/ Share on other sites More sharing options...
wildteen88 Posted March 30, 2008 Share Posted March 30, 2008 Use $_GET['file'] to retrieve the url variable file. Then use include. Example code: if(isset($_GET['file'])) { if(file_exists($_SERVER['DOCUMENT_ROOT'] . $_GET['file'])) { include $_SERVER['DOCUMENT_ROOT'] . $_GET['file']; } } Quote Link to comment https://forums.phpfreaks.com/topic/98646-include-question/#findComment-504837 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.