PHP에서 개체를 사용하고 있습니다. 나는 데이터베이스 서버 $ con 객체와 $ opt (연산) 객체에 연결하여 데이터베이스 서버에 질의를 보내고, 지금까지 아무런 문제가 없다. 문제는 $ con 객체를 정적으로 정의하고 정의했다는 것이다. 이 코드구문 분석 오류 : 예기치 않은 구문 오류 T_PAAMAYIM_NEKUDOTAYIM
class operations{
public static $con = null;
public function __construct($tableName = null){
// Creating an object of connection
self::$con = new config();
self::$con = self::$con->getConnection();
}
}
아래에서와 같이 $ 내가 $ 콘 개체를 호출 할 때 그래서이 문제
mysql_query($query,$opt::$con) or die (mysql_error());
는 없지만 서버에서이 오류
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
나타납니다 객체를 선택
$ opt는 클래스 작업의 객체입니다 –