您好,欢迎访问一九零五行业门户网

php算法看不懂,请高手逐句给解释下吧!该怎么处理

php算法看不懂,请高手逐句给解释下吧!急急
$mm_paramname = ;?
// *** go to record and move to record: create strings for maintaining url and form parameters
// create the list of parameters which should not be maintained
$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);
------解决方案--------------------
把get参数和post参数重新全部拼接到get参数里,形成一个url叫做mm_keepboth,由于拼接时采取了. &key=val,所以字符串开始多了一个&, 需要substr删掉。
------解决方案--------------------
来试试看。
php code $mm_paramname = ; // *** go to record and move to record: create strings for maintaining url and form parameters// create the list of parameters which should not be maintained$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 stringreset ($http_get_vars); //$http_get_vars等价于$_get。早起的php3/4版本都是用$http_get_vars,不过到了后来版本$http_get_vars被弃用了。改用$_get 了。while (list ($key, $val) = each ($http_get_vars)) { //遍历数组每项,键=$key,值=$val$nextitem = &.strtolower($key).=;if (!stristr($mm_removelist, $nextitem)) { //如果mm_removelist中不存在$nextitem$mm_keepurl .= &.$key.=.urlencode($val); //连接字符串}}// add the url parameters to the mm_keepurl stringif(isset($http_post_vars)){ //$http_post_vars同$http_get_varsreset ($http_post_vars); //重置$http_post_vars,使其指针回到0while (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); //如果$mm_keepboth字节长度大于0,则从1字节位置截取到末尾if (strlen($mm_keepurl) > 0) $mm_keepurl = substr($mm_keepurl, 1); //类似上面if (strlen($mm_keepform) > 0) $mm_keepform = substr($mm_keepform, 1); //类似上面

其它类似信息

推荐信息