zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

flash用php连接数据库的代码

2023-06-13 09:14:27 时间
php代码:
复制代码代码如下:

/*/flashservices/services/Catalog.php*/
classCatalog{
    var$products_array=array();

//Constructor:Containsthelistofmethodsavailabletothegateway
functionCatalog(){
    $this->methodTable=array(
        "getProducts"=>array(
            "description"=>"Getlistofproducts",
            "access"=>"remote",
            "arguments"=>""//argumentscouldbeoptional,nottested
        )
    );//endmethodTable
}

functiongetProducts(){    
    //yourcodegoeshere

    return$this->products_array;
}
}

actionscript代码:
复制代码代码如下:

#include"NetServices.as"
NetServices.setDefaultGatewayUrl("http://yourserver.com/flashservices/gateway.php");
gw=NetServices.createGatewayConnection();
CatalogREMOTE=gw.getService("Catalog",this);
CatalogREMOTE.getProducts();

getProducts_Result=function(result){
    _root.products_results=result;