PHP eval a string as a class

EurekA

I'm retreiving a string and I would like to call it as a new class

I've tried : $class = eval("new $string()") but it's not working.

$class = eval("new {$string}()");
Dharman

You don't need eval for that.

$class = new $string();

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Bash string eval unclear

분류에서Dev

php eval condition understanding

분류에서Dev

PHP array, C# (string, class)

분류에서Dev

PHP array, C# (string, class)

분류에서Dev

JavaScript - pass string variable to eval

분류에서Dev

php eval() error after updating

분류에서Dev

JSP에서 SPEL eval @ environment.getProperty (String string, Class <T> targetType)를 사용하는 방법은 무엇입니까?

분류에서Dev

discord.py 방법 eval (string)

분류에서Dev

javascript eval cannot understand some RegEx in string?

분류에서Dev

PHP eval () 내부의 문

분류에서Dev

How to evaluate a PHP expression without using eval()

분류에서Dev

self.class.class_eval을 instance_eval과 동일하게 투여합니까?

분류에서Dev

run php script from database record without using eval()

분류에서Dev

grep, xargs, sed to clean up PHP eval hack

분류에서Dev

php array of objects can't get object property (Object of class stdClass could not be converted to string)

분류에서Dev

How to find php files with code outside of a function or class and doesn't contain a string?

분류에서Dev

ArrayList <Class>의 String []

분류에서Dev

class_eval의 초기화되지 않은 상수

분류에서Dev

Difference between String class and StringBuffer class

분류에서Dev

Iterator.class 대 Iterator <String> .class

분류에서Dev

PHP call a static method of a class by class name

분류에서Dev

name-as-string -inverse eval에 의한 파이썬 액세스 변수

분류에서Dev

Gson custom deserializer for String class

분류에서Dev

Dictionary <string, class> 생성

분류에서Dev

php string functions are not working

분류에서Dev

Parsing this string with regex PHP

분류에서Dev

Atomic string replacement in PHP

분류에서Dev

create_function없이 eval없이 PHP 깨끗한 데이터

분류에서Dev

Eval을 사용하여 원격 PHP 파일 포함

Related 관련 기사

  1. 1

    Bash string eval unclear

  2. 2

    php eval condition understanding

  3. 3

    PHP array, C# (string, class)

  4. 4

    PHP array, C# (string, class)

  5. 5

    JavaScript - pass string variable to eval

  6. 6

    php eval() error after updating

  7. 7

    JSP에서 SPEL eval @ environment.getProperty (String string, Class <T> targetType)를 사용하는 방법은 무엇입니까?

  8. 8

    discord.py 방법 eval (string)

  9. 9

    javascript eval cannot understand some RegEx in string?

  10. 10

    PHP eval () 내부의 문

  11. 11

    How to evaluate a PHP expression without using eval()

  12. 12

    self.class.class_eval을 instance_eval과 동일하게 투여합니까?

  13. 13

    run php script from database record without using eval()

  14. 14

    grep, xargs, sed to clean up PHP eval hack

  15. 15

    php array of objects can't get object property (Object of class stdClass could not be converted to string)

  16. 16

    How to find php files with code outside of a function or class and doesn't contain a string?

  17. 17

    ArrayList <Class>의 String []

  18. 18

    class_eval의 초기화되지 않은 상수

  19. 19

    Difference between String class and StringBuffer class

  20. 20

    Iterator.class 대 Iterator <String> .class

  21. 21

    PHP call a static method of a class by class name

  22. 22

    name-as-string -inverse eval에 의한 파이썬 액세스 변수

  23. 23

    Gson custom deserializer for String class

  24. 24

    Dictionary <string, class> 생성

  25. 25

    php string functions are not working

  26. 26

    Parsing this string with regex PHP

  27. 27

    Atomic string replacement in PHP

  28. 28

    create_function없이 eval없이 PHP 깨끗한 데이터

  29. 29

    Eval을 사용하여 원격 PHP 파일 포함

뜨겁다태그

보관