htmlEnt() 공개 정적인 메소드

Convert >, <, ', " and & to html entities, but preserves entities that are already encoded.
public static htmlEnt ( string $string, boolean $encodedEntities = false ) : string
$string string The text to be converted
$encodedEntities boolean
리턴 string
예제 #1
0
파일: Filter.php 프로젝트: jbzoo/utils
 /**
  * @param $string
  * @return string
  */
 public static function html($string)
 {
     return Str::htmlEnt($string);
 }
예제 #2
0
파일: StringTest.php 프로젝트: jbzoo/utils
 public function testHtmlentities()
 {
     is('One &amp; Two &lt;&gt; &amp;mdash;', Str::htmlEnt('One & Two <> &mdash;'));
     is('One &amp; Two &lt;&gt; &mdash;', Str::htmlEnt('One &amp; Two <> &mdash;', true));
 }