本文整理匯總了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;
}