本文整理汇总了PHP中SpoonFilter::isAlphaNumeric方法的典型用法代码示例。如果您正苦于以下问题:PHP SpoonFilter::isAlphaNumeric方法的具体用法?PHP SpoonFilter::isAlphaNumeric怎么用?PHP SpoonFilter::isAlphaNumeric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpoonFilter
的用法示例。
在下文中一共展示了SpoonFilter::isAlphaNumeric方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPasUsu
public function setPasUsu($passwordUsuario)
{
if (SpoonFilter::isSmallerThan(40, strlen($passwordUsuario)) && SpoonFilter::isString($passwordUsuario) && SpoonFilter::isAlphaNumeric($passwordUsuario)) {
$this->passwdUsu = sha1($passwordUsuario);
} else {
echo "Introduzca una contraseña correcta, use sólo números y letras";
exit;
}
}
示例2: isAlphaNumeric
/**
* Checks if this field only contains letters & numbers (without spaces).
*
* @return bool
* @param string[optional] $error The error message to set.
*/
public function isAlphaNumeric($error = null)
{
// filled
if ($this->isFilled()) {
// post/get data
$data = $this->getMethod(true);
// validate
if (!isset($data[$this->attributes['name']]) || !SpoonFilter::isAlphaNumeric($data[$this->attributes['name']])) {
if ($error !== null) {
$this->setError($error);
}
return false;
}
return true;
}
// not submitted
if ($error !== null) {
$this->setError($error);
}
return false;
}
示例3: getExtension
/**
* Fetch the extension for a filename.
*
* @return string The extension.
* @param string $filename The full path of the file.
* @param bool[optional] $lowercase Should the extension be returned in lowercase or in its original form.
*/
public static function getExtension($filename, $lowercase = true)
{
// init var
$filename = $lowercase ? strtolower((string) $filename) : (string) $filename;
// fetch extension
$chunks = (array) explode('.', $filename);
// count the chunks
$count = count($chunks);
// has an extension
if ($count != 0) {
// extension can only have alphanumeric chars
if (SpoonFilter::isAlphaNumeric($chunks[$count - 1])) {
return $chunks[$count - 1];
}
}
// no extension
return '';
}
示例4: testIsAlphaNumeric
public function testIsAlphaNumeric()
{
$this->assertTrue(SpoonFilter::isAlphaNumeric('John09'));
$this->assertFalse(SpoonFilter::isAlphaNumeric('Johan Mayer 007'));
// Simulating PHP < 5.4 behaviour
$this->assertTrue(SpoonFilter::isAlphaNumeric(array('a', 'b')));
}
示例5: testIsAlphaNumeric
public function testIsAlphaNumeric()
{
$this->assertTrue(SpoonFilter::isAlphaNumeric('John09'));
$this->assertFalse(SpoonFilter::isAlphaNumeric('Johan Mayer 007'));
}