AMFPHP 2.2后台调用简单工作,但调用amf返回null?

时间:2015-01-29 15:31:08

标签: php mysql amfphp

在后台调用简单的一切都很好我只需要用UID(userid)填写相应的字段但是当我使用调用AMF时它返回null

<?php

班级Gotoandlearn     {
    公共函数__construct()     {

    //mysql_connect("server", "username", "password");
    //mysql_select_db("database");
}

/**
 * Retrieves tutorial data
 * @returns title, description, and url
 */
function getTutorials($myId)
{

    $servername = "localhost";
    $username = "xxx";
    $password = "xxx";
    $dbname = "xxx";
    $conn = new mysqli($servername, $username, $password, $dbname);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    } 
    $sql = "SELECT Name, Map FROM xxx WHERE Uid=$myId";
//  $sql = "SELECT Uid, Name, Map FROM xxx";
    $result = $conn->query($sql);

    // Check connection

    if ($result->num_rows > 0) {
    return $result;






        } else {
            echo false;
        }
        $conn->close();



    //return mysql_query("SELECT title, description, url FROM Tutorials");
    }
}

&GT;

1 个答案:

答案 0 :(得分:0)

使用Amfphp,您无法返回资源。最佳做法是使用PDO http://php.net/manual/en/book.pdo.php,它返回一个可以发回的对象或数组。

您可以在此处查看一些示例代码https://github.com/silexlabs/amfphp-2.0/blob/master/Examples/Php/ExampleServices/UserService.php