
这个是属于GET传值
接受代码如下:
<php
$id=$_GET['id'];
print $id;
>
在你使用<form method="get">或者你直接修改href的时候就会出现此种传值。
题外说一点,多个传值的格式为:
indexphpid=1&name=me&length=2
唔,反正有空,给你写个完整点的,我估计你的想法是在indexphp传值,并且在indexphp接受:
<php
$id=0;
if(isset($_GET['id'])){
$id=$_GET['id'];
}//存在id传值时候,获取id值,不然id赋值为0
print "ID值为:"$id;
>
<br><hr/>
<form action="indexphp" method="get">
请输入ID值:<input type=text name=id >
<input type=submit>
</form>
这是一个跨域访问问题,以前这种问题是比较复杂的。不过随着XML josn等等数据结构的应用
现在还是很好解决的 而且你的要求也不高 只是一个返回值的话 都用不到数据结构了 直接页面输出就好了
我写了两个简单的文件给你 里面的域名和文件名参数 你都可以自己调整 我测试是没问题的
//testphp
<php
$ch = curl_init();
$str ='>
test1php
<form action="test2php" method="post">
<input type="text" name="username" /><br/>
<input type="password" name="pw" /><br/>
<input type="submit" name="sbmit" value="提交" />
</form>
test2php
<php
$username = $_POST['username'];
$pw = $_POST['pw'];
echo "用户名:"$username;
echo "<br/>";
echo "密码:"$pw;
>
test2php 这里也可以这样写。
<php
extract($_POST);
echo "用户名:"$username;
echo "<br/>";
echo "密码:"$pw;
>
以上就是关于tp5伪静态get参数如何只获取参数,不获取路由全部的内容,包括:tp5伪静态get参数如何只获取参数,不获取路由、jquery如何快速获取页面的get传值、php如何通过get方法发送http请求,并且得到返回的参数等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)