php e() and h() functions?

前端 未结 13 1818
情书的邮戳
情书的邮戳 2021-02-03 19:06

I and lately I\'m seeing h() and e() functions in PHP. I have googled them, but they are so short that results don\'t give any idea of what they are. I

相关标签:
13条回答
  • 2021-02-03 19:40

    I'd guess that h() escapes user-submitted data for safe output, and e() escapes for database insertion. Whatever the functionality, these are not stock PHP functions.

    0 讨论(0)
  • 2021-02-03 19:44

    In CakePHP h() is: Convenience wrapper for htmlspecialchars()

    For more information about Global constants and functions in CakePHP view this link

    http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html

    0 讨论(0)
  • 2021-02-03 19:45

    Most likely, they are dummy functions someone introduced for the sake of brevity. The h(), for example, looks like an alias for htmlspecialchars():

    function h($s)
    {
        return htmlspecialchars($s);
    }
    

    So look for them in the include files. Espec. the ones with names likes "util.php" or "lib.php".

    0 讨论(0)
  • 2021-02-03 19:46

    It looks like it might be CakePHP.

    See e()

    e (mixed $data)

    Convenience wrapper for echo().

    This has been Deprecated and will be removed in 2.0 version. Use echo() instead.

    See h()

    h (string $text, string $charset = null)

    Convenience wrapper for htmlspecialchars().

    0 讨论(0)
  • 2021-02-03 19:46

    There aren't any functions in PHP called h() and e(). They must be declared in the project you are working on. search for them and find out what they do.

    0 讨论(0)
  • 2021-02-03 19:52

    It's CakePHP.

    echo h('some stuff')
    

    Is just htmlspecialchar()ing the stuff.

    0 讨论(0)
提交回复
热议问题