本帖最后由 yinfoo8 于 2010-06-19 14:38:06 编辑

解决方案 »

  1.   

    我还写了一种写法  function getInfo1($a){
    $this->db->open("SELECT * FROM fke_website");
    $result = array();
    while ($rs = $this->db->next()) {
    $result[] = $rs;
    }
    return $result[0];
    }怎么把值返回呢  return  参数  怎么写 请高手指教。。
      

  2.   

    兄弟,你记住这么一句话,类至少得有Class
      

  3.   

    你这个不能叫类,你参考一下php手册,里面有几个不错的例子
      

  4.   

    这哥们估计是学Java的 你也请记住一句话 不是所有情况都必须要用class的 PHP数组可以完成所有数据结构的操作
      

  5.   


    不是啦。 我只是贴出了其中一个方法   部分代码而已 class  website{
    val ****
    function getInfo1($a){
        $this->db->open("SELECT * FROM fke_website");
        $result = array();
        while ($rs = $this->db->next()) {
            $result[] = $rs;
        }
        return $result[0];
    }
    }
      

  6.   


    class  website{
        private $db;
        public $tmp2;
        protected $tmp3;    public __construct()
        {
            $this->db = new mysql_db(); // mysql_db是一个操作数据库的类;
        }    function getInfo1($a){
            $this->db->open("SELECT * FROM fke_website");
            $result = array();
            while ($rs = $this->db->next()) {
                $result[] = $rs;
            }
            return $result[0]; // 这里有点问题,如果$result没有0元素就会出错
        }
    }$mydb = new website();
    $myval = $mydb->getInfo1();
    echo $myval['字段名称'];
      

  7.   

    为什么$a这个变量在function getInfo1里面没有出现?
      

  8.   

    return $abc;    你这个 return 己经是一个数组来的了。