当前位置: 代码迷 >> PHP >> PHP 传值的有关问题
  详细解决方案

PHP 传值的有关问题

热度:62   发布时间:2016-04-28 18:23:28.0
PHP 传值的问题

public function index(){
       $Dao = M("zhaopin");
// 构造查询条件
$condition['Position'] = $_GET['Position'];
$condition['Recruitment'] = $_GET['Recruitment'];
$condition['Position'] = array('like',"%".$_GET['Position']."%");
$condition['Recruitment'] = array('like',"%".$_GET['Recruitment']."%");
// 计算总数
$count = $Dao->where($condition)->count();
// 导入分页类
import("ORG.Util.Page");
// 实例化分页类
$p = new Page($count,40);
// 获取查询参数
$map['Position'] = $_GET['Position'];
$map['Recruitment'] = $_GET['Recruitment'];
foreach($map as $key=>$val) {
$p->parameter .= "$key=".urlencode($val)."&";
}
// 分页显示输出
$page = $p->show();
// 当前页数据查询
$list = $Dao->where($condition)->order('id DESC')->limit($p->firstRow.','.$p->listRows)->select();
       // 赋值赋值
$this->assign('page', $page);
$this->assign('list', $list);
$this->display();
}


<a href="/index.php/Zhaopin/" >全部</a>
<a href="/index.php/Zhaopin/index?Position=物流专员/助理">物流专员/助理</a>
<a href="/index.php/Zhaopin/index?Position=物流经理/主管">物流经理/主管</a>
<a href="/index.php/Zhaopin/index?Position=物流总监">物流总监</a>
<a href="/index.php/Zhaopin/index?Position=调度员">调度员</a>
<a href="/index.php/Zhaopin/index?Position=快递员">快递员</a>
<a href="/index.php/Zhaopin/index?Position=仓库管理员">仓库管理员</a>
<a href="/index.php/Zhaopin/index?Position=仓库经理/主管">仓库经理/主管 </a>
<a href="/index.php/Zhaopin/index?Position=装卸/搬运工">装卸/搬运工</a>
<a href="/index.php/Zhaopin/index?Position=供应链管理">供应链管理</a>
<a href="/index.php/Zhaopin/index?Position=单证员">单证员 </a>
<a href="/index.php/Zhaopin/index?Position=国际货运">国际货运</a>
<a href="/index.php/Zhaopin/index?Position=其它职位">其它职位</a></dd>


<a href="/index.php/Zhaopin/">全深圳</a> 
<a href="/index.php/Zhaopin/index?Recruitment=罗湖区">罗湖区</a>
<a href="/index.php/Zhaopin/index?Recruitment=福田区">福田区</a>
<a href="/index.php/Zhaopin/index?Recruitment=南山区">南山区</a>
<a href="/index.php/Zhaopin/index?Recruitment=盐田区">盐田区</a>
<a href="/index.php/Zhaopin/index?Recruitment=宝安区">宝安区</a>
<a href="/index.php/Zhaopin/index?Recruitment=龙岗区">龙岗区</a>
<a href="/index.php/Zhaopin/index?Recruitment=光明新区">光明新区</a>
<a href="/index.php/Zhaopin/index?Recruitment=坪山新区">坪山新区</a>
<a href="/index.php/Zhaopin/index?Recruitment=大鹏新区">大鹏新区</a>
<a href="/index.php/Zhaopin/index?Recruitment=龙华新区">龙华新区</a>
<a href="/index.php/Zhaopin/index?Recruitment=深圳周边">深圳周


点击上面的 任何一个  在点击下面的 任何一个 2个 怎么传值呢  
我要的是/index.php/Zhaopin/index?Position=其它职位&Recruitment=坪山新区
------解决思路----------------------
<a href="/index.php/Zhaopin/index?Position=其它职位&Recruitment=罗湖区"">
------解决思路----------------------
引用:
Quote: 引用:

<a href="/index.php/Zhaopin/index?Position=其它职位&Recruitment=罗湖区"">

点击的时候 才能获取Recruitment  这样的写法 是写死的 不可以

你是post 还是get
------解决思路----------------------
这个不是前端构造URL时的问题吗?
------解决思路----------------------
你get两次
你应该是想得到在地址栏点击后在地址栏出现这个吧index.php/Zhaopin/index?Position=其它职位&Recruitment=罗湖区""
------解决思路----------------------
这个可以用jQuery的方式做,像jQuery.address.parameter(key,value)这样,就会在地址栏中拼接上参数和值,还是很好用的!!!
  相关解决方案