/**
* 递归获取当前id下所有子id
*
* @param [type] $party_id
* @return void
*/
public function _getPartyIds($party_id)
{
$where['parent_id'] = $party_id;
$ids = '';
$list = db('party')->where($where)->field('id')->select();
if ($list) {
foreach ($list as $item) {
$ids .= ',' . $item['id'];
$ids .= $this->_getPartyIds($item['id']);
}
}
return $ids;
}
/**
* 检查是否超过指定长度
* 长度返回true
*
* @param [type] $str
* @param integer $length
* @return void
*/
function check_max_length($str, $length = 10)
{
$strLength = mb_strlen($str, "utf-8");
if ($strLength > $length) {
return true;
}
return false;
}
/**
* 判断是否是手机号
*
* @param [type] $str
* @param integer $length
* @return boolean
*/
function is_mobile($str)
{
if (preg_match("/^1[34578]\d{9}$/", $str)) {
return true;
} else {
return false;
}
}
PHP 工具:递归,检查手机号,长度
猜你喜欢
转载自blog.csdn.net/yuhezheg/article/details/104392856
今日推荐
周排行