本文整理匯總了PHP中InputFilter::strip_illegal_entities方法的典型用法代碼示例。如果您正苦於以下問題:PHP InputFilter::strip_illegal_entities方法的具體用法?PHP InputFilter::strip_illegal_entities怎麽用?PHP InputFilter::strip_illegal_entities使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InputFilter
的用法示例。
在下文中一共展示了InputFilter::strip_illegal_entities方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testStrip_illegal_entities
public function testStrip_illegal_entities()
{
// test valid entities
$this->assertEquals('Valid:  ', InputFilter::strip_illegal_entities('Valid:  '));
$this->assertEquals('Valid: ', InputFilter::strip_illegal_entities('Valid: 
'));
$this->assertEquals('Valid: ®', InputFilter::strip_illegal_entities('Valid: ®'));
// test valid entity corner cases
$this->assertEquals('This is valid: ®.', InputFilter::strip_illegal_entities('This is valid: ®.'));
$this->assertEquals('This is valid: ®<br />.', InputFilter::strip_illegal_entities('This is valid: ®<br />.'));
$this->assertEquals('This is valid: ®\\nDee-dum.', InputFilter::strip_illegal_entities('This is valid: ®\\nDee-dum.'));
// test invalid named entity
$this->assertEquals('This entity does not exist: .', InputFilter::strip_illegal_entities('This entity does not exist: &zomg;.'));
// test invalid numeric entity
$this->assertEquals('This entity is invalid: .', InputFilter::strip_illegal_entities('This entity is invalid: 󿷩.'));
}
示例2: test_invalid_entity_numeric
function test_invalid_entity_numeric()
{
$this->assert_equal(InputFilter::strip_illegal_entities('This entity is invalid: 󿷩.'), 'This entity is invalid: .');
}