Escaper

Class Phalcon\Escaper

implements Phalcon\EscaperInterface

Escapes different kinds of text securing them. By using this component you may prevent XSS attacks. This component only works with UTF-8. The PREG extension needs to be compiled with UTF-8 support.

$escaper = new Phalcon\Escaper();
$escaped = $escaper->escapeCss("font-family: <Verdana>");
echo $escaped; // font\2D family\3A \20 \3C Verdana\3E

Methods

public setEncoding (string $encoding)

Sets the encoding to be used by the escaper

$escaper->setEncoding('utf-8');

public string getEncoding登录查看完整内容