Copy CodeThe code is as follows:
/* Simple use method and operation of filter () */
Require_once ("zend/loader.php");
string-to-lowercase classes and uppercase classes that introduce filter
Zend_loader::loadclass ("Zend_filter_stringtolower");
Zend_loader::loadclass ("Zend_filter_stringtoupper");
Instantiate string to lowercase class and go to uppercase class
$Filter = new Zend_filter_stringtolower ();
$Filter 2 = new Zend_filter_stringtoupper ();
Set the string to be converted
$Temp = ' Zhouwujie Zhouwujie ';
Conversion method Filter ();
$Result = Filter $Filter, $Temp);
$Result 2 = $Filter 2, filter ($TEMP);
Echo $Result;
echo $Result 2;
?>
copy code code as follows:
!--? PHP /* How to use the filter and operation (filter chain) */
Require_once ("zend/loader.php");
Filter's filter chain is used to load filters and filter the method class
Zend_loader::loadclass ("Zend_filter");
Zend_loader::loadclass ("Zend_filter_htmlentities");
Zend_loader::loadclass ("Zend_filter_striptags");
//Instantiate filter after adding filter addfilter (new Filter Method class name ())
$Filter = new Zend_filter ();
$Filter//-> addfilter (New Zend_filter_htmlentities ());
-AddFilter (New Zend_filter_striptags ());
$String = "link";
$Result = $Filter Filter ($String);
Echo $Result;
?
Copy the Code code as follows:
/* Custom Filter */
Require_once ("zend/loader.php");
Zend_loader::loadclass ("Zend_filter_interface");
Class Myfilter implements Zend_filter_interface
{
Public Function filter ($value)
{
$List = Array (' Yellow ', ' bet ', ' poison ');
foreach ($List as $k = $v)
{
$value = Str_replace ($v, ' * ', $value);
}
return $value;
}
}
$Filter = new Myfilter ();
$String = ' This message is yellow content ';
$String 2 = ' He went to gamble today ';
$String 3 = ' He's taking drugs today ';
echo "Filter content
";
echo $Filter Filter ($String). "
";
echo $Filter Filter ($String 2). "
";
echo $Filter Filter ($String 3). "
";
?>
http://www.bkjia.com/PHPjc/741265.html www.bkjia.com true http://www.bkjia.com/PHPjc/741265.html techarticle Copy the code as follows:? PHP/* Filter Simple use method and operation () */require_once ("zend/loader.php");//introduce filter string to lowercase class and go to uppercase class Zend_loader:: ...