$links = "show.php?id=".$swfrow["info_id"]."&unit_id=".$unit_id;用上面的语句只能传递show.php?id=[参数],后面的&unit_id=[参数]这一段总是传递不过去。我在做一个和http://www.csdn.net/首页的右边的那个动态图片切换一样的功能,
我用上面的语句就不行,只能传递前半部分的参数,不能传递后半部分的参数,
请高手帮忙实现一下如何传递多个参数,感谢了。

解决方案 »

  1.   

    不可能的
    除非$swfrow["info_id"]上面有问题
      

  2.   

    如果这样呢?
    $var=$swfrow["info_id"];
    $links = "show.php?id='$var'&unit_id='$unit_id'"; [/code]
      

  3.   

    $links = "show.php?id=".$swfrow[info_id]."&unit_id=".$unit_id; 这样写才对吧
      

  4.   

    应该是$swfrow["info_id"]内含有#字符,可以encode下参数
    $links = "show.php?id=".urlencode($swfrow["info_id"])."&unit_id=".$unit_id; 
      

  5.   

    可能是我说的不够清楚吧,上面的方法在平常的页面是没有问题的,
    关键是我要做一个和www.csdn.net首页右边的动态图片切换的功能,那个是要用到FALSH的,
    我现在怀疑是不是FALSH代码中不支持“&”所以导致了我的后面的参数不能正常传递,下面是我的全部代码,请大家帮忙分析一下,谢谢 
    $swfsql = "select * from table".$unit_id." where pic_url<>'' order by info_id desc LIMIT 0,8";
    $swfres = mysql_query($swfsql);
    $i = 0;
    while($swfrow=mysql_fetch_array($swfres)){
          $i += 1;
      if (!$pics){$pics = $swfrow['pic_url'];} else{$pics = $pics."|".$swfrow['pic_url'];}
      
      if (!$links){
        $links = "show.php?id=".$swfrow["info_id"]."&unit_id=".$unit_id;
    } else{
    $links = $links."|show.php?id=".$swfrow["info_id"]."&unit_id=".$unit_id;
    }
      
      if (!$texts){$texts = toFixLen1($swfrow['info_subject'],40);} else{$texts = $texts."|".toFixLen1($swfrow['info_subject'],40);}
     } 
    ?>
     
    <script type="text/javascript"><!--var focus_width = 418;
    var focus_height = 240;
    var text_height = 20;
    var swf_height = focus_height+text_height;
    var pics = "<?=$pics?>";
    var links = "<?=$links?>";
    var texts = "<?=$texts?>";
        
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
    document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/web1/pix.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
    document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
    //document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
    //document.write('<embed src="http://pic.zol.com.cn/pix.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');                
    document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
    document.write('<embed src="images/web1/pix.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');                
    document.write('</object>');
                                            
    //-->
    </script>
      

  6.   

    echo $links;看看是什么样的串.
      

  7.   

    回复9楼echo $links后的字符串为:show.php?id=14&unit_id=001|show.php?id=8&unit_id=001|show.php?id=7&unit_id=001|show.php?id=6&unit_id=001从循环中得到的字符串是没什么问题的,到了后面var links = "<?=$links?>";之后再传递到下面这两句中就只剩下show.php?id=14了document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
    document.write('<embed src="images/web1/pix.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');                
      

  8.   

    回复9楼foolbirdflyfirst在输入的FLASH代码参数中'&links='+links而参数links中又包含了"&",所以最终的结果就是&links=show.php?id=14&unit_id=001这样一来系统可能认为是两个变量了&links和&unit_id,所以就只传递了前半部分所以我想还有没有别的方法能代替“&”
      

  9.   

    传给flash的参数串里已经用&作为参数的分割符了FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'"这时候links再包含&,flash那边就解析错了,而不是不支持&.可以自己格式化参数串,
    比如show.php?p=14--001,这样传过去,在show.php获得$_GET['p']再以--切分,默认 第一个就是id参数值,第二个就是unit_id参数值,这个可以自己指定.
      

  10.   

    嗯,也只能这样了,非常感谢foolbirdflyfirst