简体   繁体   English

php 通过 URL 传递参数:

[英]php passing parms via the URL:

mimo.php is my main file... mainjob.php contains the div's that I want to $get mimo.php 是我的主文件... mainjob.php 包含我想要$get的 div

this is an example of my link...这是我的链接的一个例子......

.../pes/mimo.php?rack=1&jobs=0&hosts=1 this means that only entries related to rack 1 will be displayed. .../pes/mimo.php?rack=1&jobs=0&hosts=1 这意味着只显示与机架 1 相关的条目。 The jobs list will not be displayed, but the host menu will be displayed不会显示作业列表,但会显示主机菜单

I'm passing the variables like this...我正在传递这样的变量......

 echo $_GET["rack"] ;

 echo $_GET["jobs"] ;

 echo  $_GET["hosts"] ;

Rack would echo a grouping of divs with the contents: r1, r2, r3 Jobs it's grouping of divs: j1, j2, j3 Hosts: h1,h2, h3 Rack 会回显一组 div,内容为:r1, r2, r3 Jobs 它是一组 div:j1, j2, j3 Hosts: h1,h2, h3

I'm looking to connect the dots between passing the parameter and getting the data... Anyone feel me?我希望将传递参数和获取数据之间的点联系起来......有人感觉到我吗?

Best, William最好的,威廉

Incorrect: .../pes/mimo.php?rack=1+jobs=0+hosts=1不正确:.../pes/mimo.php?rack=1+jobs=0+hosts=1

Correct: .../pes/mimo.php?rack=1&jobs=0&hosts=1正确:.../pes/mimo.php?rack=1&jobs=0&hosts=1

echo $_GET["rack"]; // = 1
echo $_GET["jobs"]; // = 0
echo $_GET["hosts"]; // = 1

Using + is a space operator, meaning that rack = 1 jobs=0 (replace the + with an &)使用+是一个空格运算符,这意味着 rack = 1 jobs=0 (用 & 替换 +)

For the browser, it uses the + for spaces, like &jobs=my+job , and then using $_GET["jobs"] would return my job对于浏览器,它使用 + 表示空格,例如&jobs=my+job ,然后使用$_GET["jobs"]将返回my job

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

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