Home > Backend Development > PHP Tutorial > 怎么把链接中带的字符串弄到PHP里

怎么把链接中带的字符串弄到PHP里

WBOY
Release: 2016-06-13 10:27:35
Original
1018 people have browsed it

如何把链接中带的字符串弄到PHP里
如何把链接中带的字符串弄到PHP里呢?
比如链接是http://www.xxxxx.com.cn/goods.php?goods_id=183

程序入如下




问题如下:
语句value=183,当链接中的183变成其他数时,VALUE后面带的值也会随之变化。我知道ASP里是用request来实现,但是PHP里就不会了,请各位大师帮忙。

------解决方案--------------------
if (!empty($_GET['goods_id'])){
$value=intval($_GET['goods_id']);
}else{
$value='';
}
?>
type=hidden>
------解决方案--------------------

PHP code
<?php #接收form内容并进行处理if(isset($_GET['goods_id'])){  echo $id = $_GET['goods_id'];  //此处用GET获取连接后的参数  print_r($_POST);               //表单中的method指定的传输方式,在提交后作为全局数组,$_POST即表单数据}?><!--form中的action指向php接收数据的页面,包括参数,或由php动态指定参数值:goods_id=<?=$goods_id?>-->
Copy after login

------解决方案--------------------
探讨

ASP语句是


type=hidden>



请帮忙,谢谢
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template