本文整理汇总了PHP中ConvertUtil::getPY方法的典型用法代码示例。如果您正苦于以下问题:PHP ConvertUtil::getPY方法的具体用法?PHP ConvertUtil::getPY怎么用?PHP ConvertUtil::getPY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConvertUtil
的用法示例。
在下文中一共展示了ConvertUtil::getPY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUser
private function addUser($users)
{
$count = 0;
try {
foreach ($users as $user) {
$account = ConvertUtil::getPY($user["username"]);
$data = array("account" => $account, "name" => $user["realname"], "gender" => $user["gender"] == 0 ? 2 : 1, "mobile" => $user["mobile"]);
$res = $this->getApi()->addAccount($data);
if (isset($res["ret"])) {
if ($res["ret"] == 0) {
$this->setBinding($user["uid"], implode(",", $res["data"]));
$count++;
} else {
$this->setError($res["msg"], self::ERROR_SYNC);
}
}
}
return $count;
} catch (Exception $exc) {
$this->setError($exc->getMessage(), self::ERROR_SYNC);
return 0;
}
}
示例2: foreach
echo $letter;
?>
</div>
<table class="table table-hover cl-info-table contact-list" id="contact_list">
<tbody>
<?php
foreach ($users as $k => $user) {
?>
<tr id="cl_tr_<?php
echo $user["uid"];
?>
" data-id="<?php
echo $user["uid"];
?>
" class="contact-list-item" data-preg="<?php
echo $user["realname"] . ConvertUtil::getPY($user["realname"]) . ConvertUtil::getPY($user["realname"], true);
?>
">
<td width="50">
<div class="avatar-box">
<span class="avatar-circle">
<img src="<?php
echo $user["avatar_middle"];
?>
">
</span>
</div>
</td>
<td width="90">
<span class="xcm pc-name"><?php
echo $user["realname"];
示例3: getUserByPy
public static function getUserByPy($uids = null, $first = false)
{
$group = array();
if (is_array($uids)) {
$list = User::model()->fetchAllByUids($uids);
} else {
$list = UserUtil::loadUser();
}
foreach ($list as $k => $v) {
$py = ConvertUtil::getPY($v["realname"], $first);
if (!empty($py)) {
$group[strtoupper($py[0])][] = $k;
}
}
ksort($group);
$data = array("datas" => $list, "group" => $group);
return $data;
}