
Spoofchecker::setChecks는 문장의 위변조를 감지하기 위한 옵션을 설정하는 메서드입니다. 기본적으로는 다음과 같은 옵션들이 있습니다.
- `ALLOWED` : 허용할 위변조 옵션
- `DISALLOWED` : 금지할 위변조 옵션
- `EXTRA` : 추가 위변조 옵션
Spoofchecker::setChecks를 사용하는 방법은 다음과 같습니다.
#hostingforum.kr
php
$sentences = array(
'The quick brown fox jumps over the lazy dog.',
'The quick brown fox jumps over the lazy cat.'
);
$spoofchecker = new Spoofchecker();
$spoofchecker->setChecks(array(
'ALLOWED' => array('fox', 'dog'),
'DISALLOWED' => array('cat'),
'EXTRA' => array('jumps')
));
foreach ($sentences as $sentence) {
$result = $spoofchecker->check($sentence);
if ($result === true) {
echo "문장이 위변조되지 않았습니다.n";
} else {
echo "문장이 위변조되었습니다.n";
}
}
위 예제에서 ALLOWED 옵션은 'fox'와 'dog'를 허용하고, DISALLOWED 옵션은 'cat'를 금지하고, EXTRA 옵션은 'jumps'를 추가로 감지합니다.
2025-05-09 00:25