What situations demand the use of eval() because there are no alternatives?

后端 未结 5 1701
小蘑菇
小蘑菇 2021-01-18 00:07

I know eval should be avoided in JavaScript for speed and security reasons. But in the case of PHP, rarely is security ever mentioned. More often, it\'s your pr

5条回答
  •  一生所求
    2021-01-18 00:30

    Eval and create_function may allow arbitary code injection. There are a lot of things in PHP that can be used to compromise the security of your application.

    We tell kids not to play with knives and matches - but these are useful (if not essential) tools when used correctly. So it is with a lot of PHP's functionality. There's nothing intrinsically wrong with using the functionality as long as you understand exactly what you are doing.

    But a discussion of programming languages at such an abstract level is not what StackOverflow is about.

    C.

提交回复
热议问题