1
可能性の重複:
Initializing PHP class property declarations with simple expressions yields syntax errorカスタムクラスのインスタンスを保持する連想配列を作成できますか?
それは連想配列を作成し、値としてカスタムクラスのインスタンスを解析することは可能ですか?
ような何か:私は "予想外のキーワードNEW" のようなエラーを取得しています、これをしようと
private static $contentTypeList = array(
"News" => new ContentType("News", "news.php", "News"),
"Termine" => new ContentType("Termine", "termine.php", "Termine"),
"Zeitplan" => new ContentType("Zeitplan", "zeitplan.php", "Zeitplan"),
"Fotos" => new ContentType("Fotos", "fotos.php", "Fotos"),
"Anfahrt" => new ContentType("Anfahrt", "anfahrt.php", "Anfahrt"),
"Guestbook" => new ContentType("Guestbook", "guestbook.php", "Gästebuch")
);
。
誤った構文を使用していますか、それともできませんか?
'private'は関連していないようです。実際、あなたのソリューションは最適ではありません。 'init'は' static'ではなく、二相の初期化が必要です。 –
'variable'はやや誤解を招く:それはプロパティに関するものです。 – KingCrunch
@ TomalakGeret'kal:今すぐ修正する必要があります –