php报错non static,请教PHP不同环境出现Non-static method 错误问题

php5.2.17下代码运行正常,

php5.4以上就报错。

源码如下:

入口Gateway.php文档:

$d=$_POST['data'];

if(get_magic_quotes_gpc()){

$d=stripslashes($d);

}

$param = json_decode($d);

$ret = Command::call($param);

header('content-type:application:json;charset=utf8');

header('Access-Control-Allow-Origin:*');

header('Access-Control-Allow-Methods:POST');

header('Access-Control-Allow-Headers:x-requested-with,content-type');

echo json_encode($ret);

?>

Commadn.php文档:

require dirname(__FILE__) . '/service.inc.php';

class Command{

pulibic function call($params){

$result = self::callMethod(*********);

return $result;

}

private function callMethod(***){

try {

if(count($params)>0){

$result=call_user_func_array(Array($classStr,$funcStr),$params);

}else{

$result=call_user_func(Array($classStr,$funcStr));

}

$ret[] = 1;

$ret[] = $result;

}catch (Exception $e){

****************

}

return $result;

}

service.inc.php文档

define("WG_SERVER_BASE",dirname(__FILE__) . "/");

if (isset($GLOBALS['includefiles'.__FILE__])){

return;

}else{

$GLOBALS['includefiles'.__FILE__]=true;

function __autoload($class_name) {

//判断文件是否存在

if(strpos($class_name,"Service")!==false){

$fileUrl = WG_SERVER_BASE. 'service/'.$class_name.'.php';

}else if(strpos($class_name,"API")!==false){

$fileUrl = WG_SERVER_BASE. 'api/'.PLATFORM_TYPE."/".$class_name.'.php';

}else if(strpos($class_name,"Data")!==false){

$fileUrl = WG_SERVER_BASE. 'data/'.$class_name.'.php';

}else{

$fileUrl = WG_SERVER_BASE.$class_name.'.php';

}

if(file_exists($fileUrl)){

require $fileUrl;

}

}

date_default_timezone_set('Etc/GMT-8');

}

PH环境5.4以上报错,5.2却正常,求教如何兼容PHP5.2--5.6环境而不出错???,错误代码:

Strict standards: Non-static method Command::call()

should not be called statically in

***/Gateway.php on line 13

Strict standards: call_user_func_array() expects

parameter 1 to be a valid callback, non-static method

******** should not be called statically in ***********

Warning: Cannot modify header information - headers

already sent by (output started at

**********Command.php:62) in

*************\Gateway.php on line 16

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值