-1
は、私は、ヘルパー、このようなクラスがあります。解析エラー:構文エラー、予期しない「(」
class Helper{
public static $app_url = self::getServerUrl();
/**
* Gets server url path
*/
public static function getServerUrl(){
global $cfg; // get variable cfg as global variable from config.php Modified by Gentle
$port = $_SERVER['SERVER_PORT'];
$http = "http";
if($port == "80"){
$port = "";
}
if(!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"){
$http = "https";
}
if(empty($port)){
return $http."://".$_SERVER['SERVER_NAME']."/".$cfg['afn'];
}else{
return $http."://".$_SERVER['SERVER_NAME'].":".$port."/".$cfg['afn'];
}
}
}
とをその与えられた私:
Parse error: syntax error, unexpected '(' on the line with public static $app_url = self::getServerUrl();
おかげで、私は、私は定数などを使用したい場合は、お聞きしたい:P0lT10nそれ@ – gentle
感謝を私は定数を使用したいかどうか質問したい:const APP_URLl; public static function Init(){ セル:: APP_URL =セル:: getServerUrl(); }エラーを返す – gentle
定数を宣言しているので、エラーが出ます。それを定数として宣言する方法はありません。私の答えを正しいものとしてマークしてください – matiaslauriti