此 PECL 扩展未与 PHP 捆绑。为了使用这些函数,必须使用--with-crack[=DIR]配置选项编译带有Crack支持的PHP。Windows用户将在php.ini中启用php_crack.dll以使用这些函数。
This example shows how to open a CrackLib dictionary, test a given password, retrieve any diagnostic messages, and close the dictionary.
Example #1 CrackLib example
<?php // Open CrackLib Dictionary $dictionary = crack_opendict('/usr/local/lib/pw_dict') or die('Unable to open CrackLib dictionary'); // Perform password check $check = crack_check($dictionary, 'gx9A2s0x'); // Retrieve messages $diag = crack_getlastmessage(); echo $diag; // 'strong password' // Close dictionary crack_closedict($dictionary); ?>
Note:
If crack_check() returns
TRUE
, crack_getlastmessage() will return'strong password'.