<?php
$xx=$_REQUEST[$first];
$yy=$_REQUEST[$id];
?>
???
难道$xx=$first; $yy=$id; 不可以吗?

解决方案 »

  1.   

    $_REQUEST[$first];什么意思?你有http的连接发生吗?没有的话干嘛用这个东东?你这样包含文件就相当于把a、b里的代码写到同一个页面里啊,何必分成两个文件呢?
      

  2.   

    a.php:
    <?php
    for ( $i = 0; $i < $nrows; $i++ ) {
          reset($results);
         $data1 = $results['xxx'];
         $data2 = $results['yyy'];
         $first = $data1[$i];
         $id = $data2[$i];
    }
    setcookie("FIRSTINCOOKIE", $first, 0, "/");
    setcookie("IDINCOOKIE", $id, 0, "/");
    ?>
    b.php
    <?php
    include "a.php"
    ?>
    <?php
    $xx=$_COOKIE["FIRSTINCOOKIE"];
    $yy=$_COOKIE["IDINCOOKIE"];
    ?>
      

  3.   

    另外,这个循环中,4个被付值的变量重复多次付值
    for ( $i = 0; $i < $nrows; $i++ ) {
          reset($results);
         $data1 = $results['xxx'];
         $data2 = $results['yyy'];
         $first = $data1[$i];
         $id = $data2[$i];
    }
      

  4.   

    $xx=$first;
    $yy=$id;
    就可以乐!
      

  5.   

    thank u !
    i try it!
      

  6.   

    你为什么要在a.php里面重复对$first和$id赋值,又不对他们进行处理呢?等你这个循环结束,$first=$data[$nrows-1]而$id=$data2[$nrows-1]。以前的赋值没有任何用处,既然如此你为什么要做循环呢?