【发布时间】:2014-11-21 16:19:28
【问题描述】:
我正在尝试访问函数file_get_contents_curl。来自函数get_facebook_details()。
class frontend {
public function file_get_contents_curl($domain) {
}
public function get_all_seo_details() {
require_once('details-functions.php');
$facebook_details = get_facebook_details($cur_domain);
}
}
details-functions.php
function get_facebook_details() {
$result = file_get_contents_curl('http://graph.facebook.com/'.$username);
//.... some more code
}
我试过了:
$result = self::file_get_contents_curl('http://graph.facebook.com/'.$username);
致命错误:当没有类作用域处于活动状态时,无法访问 self::。
$result = $this->file_get_contents_curl('http://graph.facebook.com/'.$username);
非对象这个错误
$result = frontend::file_get_contents_curl('http://graph.facebook.com/'.$username);
严格标准:非静态方法 frontend::file_get_contents_curl() 不应静态调用
致命错误:调用未定义函数 file_get_contents_curl()
【问题讨论】:
-
首先,您应该去掉方法主体中的 require 语句。你为什么要这样做?