1

我有一个适用于 Mac 的AMPPS 堆栈,我正在尝试制作一个 PageRank 网络工具,它可以显示任何网站的 PageRank。

我有以下课程: https ://raw.github.com/phurix/pagerank/master/pagerank.class.php

当我使用此代码时:

包括(pagerank.class.php);

$rank = new PageRank('http://www.mysite.com');
print_r($rank);

它返回一个在 print_r() 中看起来像这样的对象: PageRank 对象 ( [host] => toolbarqueries.google.com )

根据代码,它应该给出返回的输出吗?

4

1 回答 1

0

您不能从对象构造函数返回信息。构造函数中有一个return语句(它返回file_get_contents(something))将被忽略。

改用函数。

于 2011-11-26T14:57:03.753 回答