slpctrl Posted March 30, 2008 Share Posted March 30, 2008 How does one go about achieving something like http://site.com/?file=links.html 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']; } } Link to comment https://forums.phpfreaks.com/topic/98646-include-question/#findComment-504837 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.