CakeFest 2024: The Official CakePHP Conference

Spoofchecker::isSuspicious

(PHP 5 >= 5.4.0, PHP 7, PHP 8, PECL intl >= 2.0.0)

Spoofchecker::isSuspicious指定されたテキストに、疑わしい文字が含まれていないかをチェックする

説明

public Spoofchecker::isSuspicious(string $string, int &$errorCode = null): bool

指定された文字列に、見た目は殆ど同じように見えるが、 Unicode 文字的には異なる、疑わしい文字が含まれているかを調べます。

パラメータ

string

調べる文字列

errorCode

整数のリファレンスを設定します。 エラーがあった場合には、 エラーコード値を含みます。

戻り値

疑わしい文字が含まれている場合は true を、 そうでない場合は false を返します。

例1 Spoofchecker::isSuspicious() の例

<?php
$checker
= new Spoofchecker();

$checker->isSuspicious('google.com'); // FALSE: only ASCII characters

$checker->isSuspicious('Рaypal.com'); // TRUE
// The first letter is from Cyrylic, not a regular latin "P"

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top