Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] call_user_func_array i uruchamianie klasy ze stringu
szybki
post
Post #1





Grupa: Zarejestrowani
Postów: 85
Pomógł: 0
Dołączył: 18.06.2014

Ostrzeżenie: (0%)
-----


  1. $className = 'Foo\Bar::test';


Mając taki string chciałbym uruchomić kod:

  1. $x = Foo\Bar;
  2. $x->test;


Znalazłem call_user_func_array, jednak nie można tam uruchomić tego w taiej formie, pierw trzeba podać nazwę klasy, a później jej metodę. Niby dla php 5.3 można podać string jako 1 parametr, ale gdy to robię podaje komunikat

Cytat
Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method


Tylko że test nie jest metodą statyczną.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 03:47