简体   繁体   English

HTML 将字符串从一个页面传递到另一个页面

[英]HTML passing string from one page to another

i am developing a mobile application and i need to send a certain string where i can be able to use it in an HTML page and i wanna send it from a previous HTML page ,, what's the simplest way to do so ?.我正在开发一个移动应用程序,我需要发送一个特定的字符串,我可以在 HTML 页面中使用它,我想从以前的 HTML 页面发送它,最简单的方法是什么? I have two pages index.html and home.html and i want to send a variable such as number or string from the index page to the home, as i will change the design of the home page upon this variable.我有两个页面index.htmlhome.html ,我想将一个变量(例如数字或字符串)从索引页面发送到主页,因为我将根据此变量更改主页的设计。 is there any idea how can i do it ?有什么想法我该怎么做? Thanks in Advance.提前致谢。

If you a using a server side language, A common approach is to use a query string如果您使用服务器端语言,常见的方法是使用查询字符串

For example your URL would look like this:例如,您的网址如下所示:

Home.html?myvariable=myvalue Home.html?myvariable=myvalue

In PHP the way to access the value of myvariable is to use $_GET['myvariable']在 PHP 中访问 myvariable 值的方法是使用$_GET['myvariable']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM