$todoFolder = Object::create("TodoFolder", "5661047dddb299ad5f460166");
$relation = $todoFolder->getRelation("tags");
$query = $relation->getQuery();
// 结果将包含当前 todoFolder 的所有 Tag 对象
$tags = $query->find();

此时tags数组里的每个对象的_classname 都是TodoFolder 而不是tags

你好,

能麻烦启用一下调试模式,打印请求参数看一下吗?

use LeanCloud::Client;

Client::setDebug(true);
$tags = $query->find();
Client::setDebug(false);

设置了在那里查看信息呢?
我自己找感觉问题出现在这里
Query.php的find方法

 $resp = Client::get("/classes/{$this->getClassName()}", $params);
        $objects = array();
        forEach($resp["results"] as $props) {
            $obj = Object::create(

*$this->getClassName()*
=====================

);
            $obj->mergeAfterFetch($props);
            $objects[] = $obj;
        }
        return $objects;

下边是find方法里的$this

object(LeanCloud\Query)#13 (8) {
  ["className":"LeanCloud\Query":private]=>
  string(5) "goods"
  ["select":"LeanCloud\Query":private]=>
  array(0) {
  }
  ["include":"LeanCloud\Query":private]=>
  array(0) {
  }
  ["limit":"LeanCloud\Query":private]=>
  int(-1)
  ["skip":"LeanCloud\Query":private]=>
  int(0)
  ["order":"LeanCloud\Query":private]=>
  array(0) {
  }
  ["extraOption":"LeanCloud\Query":private]=>
  array(1) {
    ["redirectClassNameForKey"]=>
    string(9) "goodsAttr"
  }
  ["where"]=>
  array(1) {
    ["$relatedTo"]=>
    array(2) {
      ["key"]=>
      string(9) "goodsAttr"
      ["object"]=>
      array(3) {
        ["__type"]=>
        string(7) "Pointer"
        ["className"]=>
        string(5) "goods"
        ["objectId"]=>
        string(24) "590197de61ff4b00668a29a5"
      }
    }
  }
}

返回的响应是这样的

array(2) {
  ["results"]=>
  array(1) {
    [0]=>
    array(13) {
      ["updatedAt"]=>
      string(24) "2017-05-05T03:58:26.678Z"
      ["isDefault"]=>
      int(0)
      ["content"]=>
      string(6) "收到"
      ["objectId"]=>
      string(24) "5909363c61ff4b0066ebcea4"
      ["createdAt"]=>
      string(24) "2017-05-03T01:45:32.633Z"
      ["isValid"]=>
      int(1)
      ["currency"]=>
      array(3) {
        ["__type"]=>
        string(7) "Pointer"
        ["className"]=>
        string(12) "lan_currency"
        ["objectId"]=>
        string(24) "58bb7a201b69e6006b1daee2"
      }
      ["originalPrice"]=>
      int(0)
      ["language"]=>
      array(3) {
        ["__type"]=>
        string(7) "Pointer"
        ["className"]=>
        string(12) "lan_language"
        ["objectId"]=>
        string(24) "58bd24eb570c35006c6905f9"
      }
      ["price"]=>
      int(10)
      ["sort"]=>
      int(1)
      ["goodsValid"]=>
      int(0)
      ["stock"]=>
      int(10000)
    }
  }
  ["className"]=>
  string(15) "goods_attribute"
}

可以看出Relation返回时sdk创建的对象classname为goods 而不是goods_attribute

你本地是如何运行 php 应用的?如果是用我们的 lean-cli 命令行,可以直接在命令行里看到 debug 日志输出。如果是用 apache/nginx ,可以分别在两者的 error 日志文件中找到相关的 http 请求。