flex4与php,错误引用函数
我正在尝试连接到 Flex4 中的 MySql 数据库。我写了一个像这样的 php 类,
public function getNames() {
$stmt = mysqli_prepare($this->connection,
"SELECT
names.firstname,
names.middlename,
names.lastname
FROM names");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,
$row->lastname);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,
$row->lastname);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
}
我只是将一个数据网格拖放到 Flex 设计模式中。然后使用数据->连接到 php 选项,我从 webroot 中选择了文件 name.php。然后flex4给出了这个错误,我对此一无所知,因为它生成了各种服务。
Flex现在期待什么?
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
getNamesResult.token = name.getNames();
}
描述 资源路径 位置类型 1061:通过静态类型 String 的引用调用可能未定义的方法 getNames。 flexphp.mxml /flexphp/src 第 12 行 Flex 问题
I'm trying to connect to MySql database in flex4. I wrote a php class like this,
public function getNames() {
$stmt = mysqli_prepare($this->connection,
"SELECT
names.firstname,
names.middlename,
names.lastname
FROM names");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,
$row->lastname);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,
$row->lastname);
}
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
}
I just dragged and droped a datagrid into flex design mode. Then using data-> connect to php option, i selected file name.php from webroot. Then flex4 is giving this error, I have no clue about it, since it generated various services.
What is the flex expecting now?
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
{
getNamesResult.token = name.getNames();
}
Description Resource Path Location Type
1061: Call to a possibly undefined method getNames through a reference with static type String. flexphp.mxml /flexphp/src line 12 Flex Problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有某种可以与 Flex 通信的层,您就无法直接在 PHP 中调用函数,因为 PHP 函数不是公开可用的。您应该查看 AMFPHP 或 ZendPHP 提供此通信层(amf 远程处理)。
You can't call a function directly in PHP without having some kind of layer that can communicate with Flex since PHP functions aren't publicly available. You should look into AMFPHP or ZendPHP which provides this communication layer (amf remoting).