本文整理汇总了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: .');
}