>  Q&A  >  본문

다양한 PHP 환경에서 발생하는 Non-static 메소드 오류에 대해 알려주세요.

코드는

php5.2.17에서는 정상적으로 실행되지만

php5.4 이상에서는 오류가 발생합니다.

소스 코드는 다음과 같습니다.

Entrance Gateway.php 문서:

<?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- 메서드:POST' );

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

echo json_encode($ret);

?>


Commadn.php 문서:

<?php

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

class 명령{

pulibic 함수 호출($params){

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

                                                                      '         '     '' {

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

                                                                                   

$ret [ ] = 1;

         $ret[] = $result;                                                                             ~ > ");

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

return;

}else{

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

function __autoload($class_name) {

} //파일 존재 여부 확인

                                                                                                               "API")!==false){

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

ㅋㅋㅋ > 8')

}

PH 환경 5.4 이상에서는 오류가 보고되는데 5.2에서는 정상입니다. PHP 5.2--5.6 환경에서 오류 없이 호환되는 방법을 알려주세요. ? ? , 오류 코드:

엄격한 표준: 비정적 메서드 Command::call() 정적으로 호출하면 안 됩니다. ***/Gateway.php 온라인 13

엄격한 표준: call_user_func_array() 기대 매개변수 1은 유효한 콜백, 비정적 메서드임 ********는 *************

에서 정적으로 호출하면 안 됩니다. 경고: 헤더 정보를 수정할 수 없습니다 - 헤더 이미 보낸 사람(출력이 다음에서 시작됨) **********Command.php:62) *************Gateway.php 라인 16

虎威虎威2370일 전4125

모든 응답(2)나는 대답할 것이다

  • 虎威

    虎威2018-03-27 11:36:28

    추가 질문: 5.2--5.6과 호환되지 않는 경우, 5.2 환경에서 정상적으로 실행될 수 있는 위 코드를 5.4 이상에서 실행 가능하도록 변환하는 방법을 알려주십시오.

    회신하다
    0
  • 好人二狗

    $obj = 새 명령; $obj->call(); 이렇게 불러보세요

    好人二狗 · 2018-03-29 12:24:01
  • 취소회신하다