flash用php连接数据库的代码
程序员文章站
2022-05-25 21:21:03
php代码:复制代码 代码如下: /* /flashservices/services/catalog.php */ class catalog { &nbs...
php代码:
/* /flashservices/services/catalog.php */
class catalog {
var $products_array = array();
// constructor: contains the list of methods available to the gateway
function catalog() {
$this->methodtable = array (
"getproducts" => array (
"description" => "get list of products",
"access" => "remote",
"arguments" => "" // arguments could be optional, not tested
)
); // end methodtable
}
function getproducts() {
// your code goes here
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;
}
复制代码 代码如下:
/* /flashservices/services/catalog.php */
class catalog {
var $products_array = array();
// constructor: contains the list of methods available to the gateway
function catalog() {
$this->methodtable = array (
"getproducts" => array (
"description" => "get list of products",
"access" => "remote",
"arguments" => "" // arguments could be optional, not tested
)
); // end methodtable
}
function getproducts() {
// your code goes here
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;
}