什么是javascript中的脚本等于PHP中的$ _SERVER ['REQUEST_URI']? [英] What is the script in javascript equals to $_SERVER['REQUEST_URI'] in php?

查看:97
本文介绍了什么是javascript中的脚本等于PHP中的$ _SERVER ['REQUEST_URI']?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过javascript附加iframe将URL传递到另一个域,当退出iframe时,其他域可以将用户返回到我网站上的上一页。如果使用php提交exit_url,则为

I want to pass a URL to another domain through javascript appending iframe, when exit the iframe, the other domain can return the user to previous page on my site. If use php to submit the exit_url, it is

$exit_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "&request=example"";

我想学习如何转换此字符串以使用在javascript。谢谢!

I would like to learn how to convert this string to use in javascript. Thanks!

推荐答案

你得到相当于 $ _ SERVER ['REQUEST_URI'] 附加 location.pathname location.search

var request_uri = location.pathname + location.search;

这篇关于什么是javascript中的脚本等于PHP中的$ _SERVER ['REQUEST_URI']?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆