时间:2021-07-01 10:21:17 帮助过:3人阅读
Sometimes it is not as straightforward as one may think to get the current url to use it inside your application. Here is a snippet that I use to fetch the current URL and use it in a script. The current url (whether http or https) is now a local variable that you can do with as you please.
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
Note: You should groom this value before using in anything sensitive, like a sql query.
爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具
http://biancheng.dnbcw.info/php/346947.html pageNo:4