require怎么传递数据

阿萨德2 2014-12-09 11:58:38
有2个页面 A页面 A.php 和 B文件 functions.php
A是提交页面
B是require 文件

怎么把A页面中的pripath值传到functions.php 页面中




a页面
<?php
require('../../class/functions.php');
$pripath=(int)$_POST['pripath'];
//当前使用的模板组
$thegid=GetDoTempGid();
?>
<form name="form1" method="post" action="ZtType.php" onsubmit="return CheckForm(document.form1);">
<input name="pripath" type="text" id="pripath" value="<?=$pripath?>这个传递到functions.php" size="30">
</form>
<?php
db_close();
$empire=null;
?>






b文件 functions.php

//优化
$ztid=$cr['ztid'];
$ztid22='mingxing/****a页面的值传到这里前面的mingxing/要的星好不是';
$yhid=$class_zr[$ztid][yhid];
if($yhid)
{
$yhadd=ReturnYhSql($yhid,$yhvar,1);
}
$query="select ztid,cid,classid,id,isgood from {$dbtbpre}enewsztinfo where ".$yhadd."cid='$classid' order by ".$addorder.$limit;
$totalquery="select count(*) as total from {$dbtbpre}enewsztinfo where ".$yhadd."cid='$classid'";//统计
$doclasspath=ReturnSaveZtPath($ztid,0);
$dopath=ECMS_PATH.$ztid22."/";
if(empty($class_zr[$ztid][zturl]))
{
$dolink=$public_r[newsurl].$ztid22."/";
}
else
{
$dolink=$class_zr[$ztid][zturl]."/";
...全文
285 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
晓敬 2014-12-10
  • 打赏
  • 举报
回复
都require了还用传参数,#4正解
lijpwsw 2014-12-10
  • 打赏
  • 举报
回复
引用 4 楼 whg4585 的回复:
require('../../class/functions.php'); $pripath=(int)$_POST['pripath']; 这两句调换一下顺序,这样functions.php就可以使用$pripath这个变量了
这个是正解 你也可以在B页面用 $_POST['pripath']; 获得值
小在在 2014-12-10
  • 打赏
  • 举报
回复
require('../../class/functions.php'); $pripath=(int)$_POST['pripath']; 这两句调换一下顺序,这样functions.php就可以使用$pripath这个变量了
  • 打赏
  • 举报
回复
首先 你确定接收到的是什么值,然后用<input type="hidden">也是可以的
  • 打赏
  • 举报
回复
用session 放,取
  • 打赏
  • 举报
回复
#4正解。。

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧