$MM_removeList = "&index=";
if ($MM_paramName != "") $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
高手请详细讲解此段代码.
if ($MM_paramName != "") $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);
while (list ($key, $val) = each ($HTTP_GET_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
高手请详细讲解此段代码.
解决方案 »
- php读取access中的新增空字段出现apache服务器错误
- 请高手指点,为什么发php Email不能成功?
- win2000 +apache2+php5+mysql4+zend安装后,访问数据库提示#2003 - 服务器没有响应
- php+smarty 下 gb2312+utf-8 乱码的问题
- 请教:为什么总是提示"require("")"错误?
- 有关打开页面
- 从mysql中读出的句柄,怎样判断有多少条记录?mysql_num_field($handle)就是这个用处?
- 我想把PHP Manual翻译成中文,谁有兴趣合作?
- PHP如何链接WebService
- 微信可以远程控制某个app的吗?
- php如何正则替换htm中的图片地址?
- 高手请进来帮帮忙!
$HTTP_GET_VARS是以前版本的$_GET
$HTTP_POST_VARS是以前版本的$_POST$MM_removeList = "&index=";
if ($MM_paramName != "") $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($HTTP_GET_VARS);//将数组的内部指针指向第一个单元
while (list ($key, $val) = each ($HTTP_GET_VARS)) {//数组赋值 详细看list函数
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {//判断$MM_removeList中有没有$nextItem
$MM_keepURL .= "&".$key."=".urlencode($val);//urlencode编码 针对中文传递问题
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){//判断$_POST值
reset ($HTTP_POST_VARS);//重置 同上一个reset
while (list ($key, $val) = each ($HTTP_POST_VARS)) {//再赋值
$nextItem = "&".strtolower($key)."=";//strtolower转换小写
if (!stristr($MM_removeList, $nextItem)) {//和$_GET部分相同
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);//判断长度后 截取全长度字符串
if (strlen($MM_keepURL) > 0) $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);
不过楼主 的精神 值得学习
不仅要知其然 ,还要知其所以然。
很好 。。
真是 后生可畏啊 呵呵