要speedphp中如何传递参数呢?

#1 aapill

我读出一个列表,然后单个读出其中的信息,用SPEEDPHP如何传递参数ID呢,请大家纠正一下,我知道下面程序肯定不错,请大家改正一下
class main extends spController
{   
function index(){
  $this->display('index.html');
}
    function customer_info(){
        $customerinfo=spClass('customerinfo');
        mysql_query('set names gbk');
        $this->result=$customerinfo->findAll();
        $contentsurl = spUrl("main", "customer_banner", array('id'=>$result['id']));
        $this->display('customer_info.html');
    }
    function customer_banner(){
        $id = $this->spArgs("id");
        $customer_banner = spClass("customerinfo");  // 还是用spClass  
        $conditions = array('id'=>$id); // 制造查找条件,这里是使用ID来查找属于ID的那条留言记录  
        $result = $customer_banner->find($conditions);  // 这次是用find来查找,我们把$condition(条件)放了进去  
        $this->display("customer_banner.html");
        }
}
如何将CUSTOMER_INFO中FINDALL的参数传递到customer_banner中呢!在customer_banner.html中显示内容呢

2010-08-02 10:35:39

#2 jake

看得不是很懂,

不过根据你最后一句,“CUSTOMER_INFO中FINDALL的参数传递到customer_banner”,其实如果customer_info和customer_banner是两个页面,我是建议你在customer_banner中进行一次findAll,也就是将customer_info的代码搬一部分过来。毕竟它们是两个页面,没必要连程序运行的结果都要共享。

PS,类似mysql_query('set names gbk');的语句建议不要使用。

2010-08-02 12:52:01