php5.2.17, but an error occurs when
php5.4 or above.
The source code is as follows:
Entrance Gateway.php document:
<?php require dirname(__FILE__) . '/Command.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 document:
<?phprequire dirname(__FILE__) . '/service.inc.php';class Command{ pulibic function call($params){ $ result = self::callMethod(**********); return $result; }service.inc.php document
<?phpdefine("WG_SERVER_BASE",dirname(__FILE__) . "/");##if (isset($GLOBALS[' includefiles'.__FILE__])){ return;}else{
$GLOBALS['includefiles'.__FILE__]=true;
function __autoload($class_name) {
//Determine whether the file exists
if(strpos($class_name,"Service")!==false){
$fileUrl = WG_SERVER_BASE. 'service/'.$class_name.'.php';
}else if(strpos($class_name,"API")!==false){
. '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. '.'. ){
require $fileUrl;
}
}
date_default_timezone_set('Etc/GMT-8');
}
In PH environment 5.4 and above, an error is reported, but in 5.2 it is normal. How can I make it compatible with PHP5.2--5.6 environment without errors? ? ? , Error code: Strict standards: Non-static method Command::call() should not be called statically in ***/Gateway.php on line 13Strict 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
Additional question: If it is not compatible with 5.2--5.6, then please tell me how to transform the above code that can run normally in the 5.2 environment to be executable in 5.4 or above?